I cant Upload SWF Files With PHP

329

I have 2 input file in 1 form. When I'm trying to post with a imageprint_r orvar_dump showing its properties.

But when I try to post with an swfprint_r orvar_dump saying empty and can't post.

So how can I upload swf files ? Thanks.

echo var_dump($_FILES);

if($_FILES["oyun_yolu_file"]["type"] == "application/x-shockwave-flash")
{
    echo "aha";
    echo var_dump($_FILES["oyun_yolu_file"]);
}

I have uploaded code already but my problem is I can't upload swf files, I can upload regular files like txt, image etc.

<form action="" method="post" enctype="multipart/form-data">
<table>
<tr>
<td>Resim Yolu</td>
<td>
<input type="text" name="resim_yolu"  />
<span id="kirmizi" >yada</span>
<input type="file" name="resim_yolu_file" />
</td>
</tr>

<tr>
<td>Oyun Yolu</td>
<td>
<input type="text" name="oyun_yolu"  />
<span id="kirmizi" >yada</span>
<input type="file" name="oyun_yolu_file" />
</td>
</tr>
</table>
</form>
980

Answer

Solution:

i tested this code by myself and it is working

<?php
//echo var_dump($_FILES);
if(isset($_POST['add']))
{
if($_FILES["oyun_yolu_file"]["type"] == "application/x-shockwave-flash")
{
  echo "aha";
  echo var_dump($_FILES["oyun_yolu_file"]);
}}
 ?>
<form action="" method="post" enctype="multipart/form-data">
<table>
<tr>
<td>Oyun Yolu</td>
<td>
<input type="text" name="oyun_yolu"  />
<span id="kirmizi" >yada</span>
<input type="file" name="oyun_yolu_file" />
</td>
</tr>

<tr>
<td>Oyun Açıklaması</td>
<td>
<textarea cols="45" rows="5" name="oyun_aciklama" ></textarea>
</td>
</tr>
<tr><td>
<input type="submit" name="add">
</td></tr></table>
</form>

the output was check your file

ahaarray(5) { ["name"]=> string(23) "Car-speakers-590x90.swf" ["type"]=> string(29) "application/x-shockwave-flash" ["tmp_name"]=> string(23) "E:\xamp\tmp\php7D0E.tmp" ["error"]=> int(0) ["size"]=> int(116887) }

People are also looking for solutions to the problem: How to loop through data from php in javascript?

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.