0

I'm trying upload audio and video files using php. In my local server $_FILES variable does not work when i'm uploading audio or video files, however the same code properly working when uploading any kind of image. I'm checking the code in simple fresh file. (I didn't include anything in this file like js, css or any php class etc)

if(isset($_REQUEST['submit'])){
    print_r($_FILES['fileToUpload']);
}
<form action="fileUpload.php" method="POST" enctype="multipart/form-data">
   Select image to upload:
   <input type="file" name="fileToUpload">
   <input type="submit" value="Upload Image" name="submit">
</form>

Code is in the same file fileUpload.php. i followed steps of this answers and also update wamp server memory according this forum instructions.

Can anyone guide me what is issue that i can resolve it. I would like to appreciate if someone guide me. Thank You So Much.

Community
  • 1
  • 1
Ayaz Ali Shah
  • 3,453
  • 9
  • 36
  • 68

2 Answers2

0

Depending on what they are already set to, try increasing one or both of these in your php.ini

post_max_size

upload_max_filesize

-2

I think it's not the code itself. I tried your example and it works. Just added the php tags to your example, but i suppose that you have them in your exapmle.

<?php
  if(isset($_REQUEST['submit'])){
    print_r($_FILES['fileToUpload']);
  }
?>
<form action="fileUpload.php" method="POST" enctype="multipart/form-data">
  Select image to upload:
  <input type="file" name="fileToUpload">
  <input type="submit" value="Upload Image" name="submit">
</form>

running it got

Array ( [name] => WP_20150614_19_03_18_Pro.mp4 [type] => video/mp4 [tmp_name] => C:\ctt\tmp\phpF707.tmp [error] => 0 [size] => 5804361 ) 
Martin S.
  • 256
  • 1
  • 10