0

I have I file upload form that looks like this

<form action="" name="edit" method="POST" class="form-horizontal" enctype="multipart/form-data">  
   <input type="file" name="zipfile">
   <input type="submit" class="btn btn-default" value="Save">
</form>

This basically POSTs to it self. But at the top of the same file I output the $_FILES array with print_r($_FILES);, but it is empty after I submit the form with a 100 kb file.

I have checked my error.log file in /var/log/apache2, but there is nothing there.

My php.ini file is set to

file_uploads = On
upload_tmp_dir = /var/www/tmpdir/
upload_max_filesize = 1024M

But the tmpdir directory remains empty. This directory is set with 775 permissions and even 777 for a test, but same results. I have also, after changing the file, restarted the Apache2 service.

I must be missing something very obvious here?

4
  • 2
    RTM php.net/manual/en/features.file-upload.post-method.php you've an important element missing. Commented Dec 1, 2015 at 19:54
  • Check what error you're getting using $_FILES['zipfile']['error']. Compare this code with the standard error messages. Commented Dec 1, 2015 at 20:10
  • you need to show us your PHP, since you tagged as such. Too many things can be at fault. Commented Dec 1, 2015 at 20:14
  • does the print_r() shows you the right temporary path ? Commented Dec 1, 2015 at 20:36

1 Answer 1

2

You need enctype="multipart/form-data" in the form tag

<form action="" name="edit" method="POST" class="form-horizontal" enctype="multipart/form-data">
   <input type="file" name="zipfile">
   <input type="submit" class="btn btn-default" value="Save">
</form>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.