A
Anonymous
Guest
Hi,
I am using the following script to try an upload a file from an HTML form to my local webserver (Apache / Php 4 on WinXP). I am doing this to test and try and learn how to do this. My PHP script is as follows:
the form is working as i get the following info when i hit submit on the form:
the error code returned is 0 which should mean that the file was uploaded.
/upload is below htdocs in the Apache folders.
I would be grateful if someone could point out what I am doing wrong as it is driving me up the wall. I have tried putting the full windows path as the upload directory but that didn't work. The upload tmp dir in php.ini is also pointing at the same directory.
Many thanks for any replies.
luke.
I am using the following script to try an upload a file from an HTML form to my local webserver (Apache / Php 4 on WinXP). I am doing this to test and try and learn how to do this. My PHP script is as follows:
Code:
<?php
$userfile = $_FILES['userfile']['name'];
if (is_uploaded_file($userfile)) {
move_uploaded_file($userfile, '/upload');
}
echo $_FILES['userfile']['error'];
print_r($_FILES);
?>
the form is working as i get the following info when i hit submit on the form:
Code:
0
Array ( [userfile] => Array ( [name] => 4.jpg [type] => image/jpeg [tmp_name] => C:\WINDOWS\TEMP\php3.tmp
[error] => 0
[size] => 74525 ) )
the error code returned is 0 which should mean that the file was uploaded.
/upload is below htdocs in the Apache folders.
I would be grateful if someone could point out what I am doing wrong as it is driving me up the wall. I have tried putting the full windows path as the upload directory but that didn't work. The upload tmp dir in php.ini is also pointing at the same directory.
Many thanks for any replies.
luke.