PHP loading error Error while getting 0, but move_uploaded_file () returns false. When I print $ _FILES, I get
Array ( [uploadedfile] => Array ( [name] => flashlog.txt [type] => text/plain [tmp_name] => /tmp/php0XYQgd [error] => 0 [size] => 3334 ) )
I am using the basic html / php tutorial, which makes me think that this might be a server problem. I check php.ini and have upload_max_filesize: 2M, post_max_size: 8M. So I'm really confused as I thought error 0 told me that it was successful.
The code I'm using is
<?php // Where the file is going to be placed $target_path = 'Test/'; $target_path = $target_path. basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else { echo "There was an error uploading the file, please try again!"; echo print_r($_FILES); } ?>
source share