I have a very basic upload script, probably lifted straight off the php.net/move_upload_files function page.
move_uploaded_file()
is failed because it canno
Try to comment out PrivateTmp=true in in /etc/systemd/system/multi-user.target.wants/apache2.service After restarting Apache, it will always use system's temporary folder, not a relative one per session.
I was trying out http://www.w3schools.com/php/php_file_upload.asp And I stumbled across the same bug.
In my case, adding a "./" before the $destination solved the problem.
bool move_uploaded_file ( string $filename , string $destination )
Are you 100% sure that the file actually is created in /tmp? If you don't have write permission (or the user the script runs as) the file wont be written to /tmp but (I'm guessing) you'll see it during the upload although it's not actually there when the upload finishes.
Edit: $_FILES['file']['error'] - Value: 7; Failed to write file to disk. Introduced in PHP 5.1.0. So check your PHP-version. If it's below 5.1 write to disk might be your problem.
I had the same problem, where 'tmp_name' would say it is being stored in '/private/var/tmp/' but the file would not exist there.
I had to add "E" to my "variables order" in php.ini ; variables_order Default Value: "EGPCS"
Hope this helps.
Your form
should use a tag like this:
<form method="post" enctype="multipart/form-data" action="...">
Use multiple/form-data
as enctype
.
I was just having this issue as well, came across this website for a solution - did not get it tho ;)
I was getting the correct info when viewing print_r($_FILES)
but was unable to execute move_uploaded_file
...
I solved the issue by checking the $upload_file
path attribute in the move_uploaded_file
function - make sure it is correct otherwise it will not work (mine was incorrect).
Also, the file in the temp location gets removed automatically, I think that is the way PHP works.
I hope this helped.