Hi,
I've read the manual on php but php just refuses to upload my files. I'm trying to upload fragments of audio say 450KB in size. register_globals is set to off and the upload_temp directory is blank(tried changing the php.ini file but doesn't take effect).I'm working on windows xp with apache&mysql.The html I use for the form:
<form enctype="multipart/form-data" action="work.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
Send this file: <input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>
here's the php code I use:
$uploaddir = 'C:\TEMP';
$uploadfile = $uploaddir . $_FILES['userfile']['name'];
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded. ";
echo "Here's some more debugging info:\n";
echo_r($_FILES);
} else {
echo "Possible file upload attack! Here's some debugging info:\n";
print_r($_FILES);
}
i've even tried just one line
echo "temp is".$_FILES['userfile']['tmp_name'];
and a temp name never comes up so i'm guessing it doesn't upload. In the top example it always says "possible file upload attack etc."
also how do i use is_uploaded_file() with the $_FILES. i've found an example where you can use it if globals are on :
is_uploaded_file($userfile)
but when i attempt it with the $_FILES he error says array to string conversion
manni
I've read the manual on php but php just refuses to upload my files. I'm trying to upload fragments of audio say 450KB in size. register_globals is set to off and the upload_temp directory is blank(tried changing the php.ini file but doesn't take effect).I'm working on windows xp with apache&mysql.The html I use for the form:
<form enctype="multipart/form-data" action="work.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
Send this file: <input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>
here's the php code I use:
$uploaddir = 'C:\TEMP';
$uploadfile = $uploaddir . $_FILES['userfile']['name'];
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded. ";
echo "Here's some more debugging info:\n";
echo_r($_FILES);
} else {
echo "Possible file upload attack! Here's some debugging info:\n";
print_r($_FILES);
}
i've even tried just one line
echo "temp is".$_FILES['userfile']['tmp_name'];
and a temp name never comes up so i'm guessing it doesn't upload. In the top example it always says "possible file upload attack etc."
also how do i use is_uploaded_file() with the $_FILES. i've found an example where you can use it if globals are on :
is_uploaded_file($userfile)
but when i attempt it with the $_FILES he error says array to string conversion
manni