So, I try to do a very basic upload 101 with PHP using HTML form. But I can't get it to work.
HTML file submit the file to a PHP file,
in the PHP file i try to debug by doing this
the $_FILES['uploadedfile']['name'] returns blank, it means that file wasn't sent to server somehow. I tried to create a tmp folder in the root folder but it doesn't resolve the problem.
Any ideas to make this work? By the way, my codes work on my other Yahoo! hosted server, but not on this local server.
here is the script that I made to quick test. The actual code I used in my applications is too complicated to be posted here.
HTML file submit the file to a PHP file,
in the PHP file i try to debug by doing this
PHP:
echo 'File name:' . $_FILES['uploadedfile']['name'];
echo 'Temp name:' . $_FILES['uploadedfile']['tmp_name'];
the $_FILES['uploadedfile']['name'] returns blank, it means that file wasn't sent to server somehow. I tried to create a tmp folder in the root folder but it doesn't resolve the problem.
Any ideas to make this work? By the way, my codes work on my other Yahoo! hosted server, but not on this local server.
here is the script that I made to quick test. The actual code I used in my applications is too complicated to be posted here.
PHP:
$target_path = "upload/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
echo 'File name:' . $_FILES['uploadedfile']['name'] . '<br>';
echo 'Temp name:' . $_FILES['uploadedfile']['tmp_name'] . '<br>';
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!";
}