I'm trying to make a simple upload script.
The script is suppose to do severel checks after form submition.
The problem is that it seems that I don't have access to HTTP_POST_VARS for
some reason.
In php.ini I have the following definitions (among others of cause):
upload_tmp_dir = "C:\php4\uploadtemp"
file_uploads = On
register_globals = On
The sending FORM looks like this (all HTML removed):
<form method=\"POST\" action=\"$PHSELF\" enctype=\"multipart/form-data\">
<input type=hidden name=AKTION value=upload_img>
<input type=file name=file>
<input type=submit value=Upload>
The receiving script looks like this:
switch($AKTION) {
case upload_img:
echo "upload check started<br>";
echo $GLOBALS['file']."<br>";
if ($HTTP_POST_VARS['submit']) {
print_r($HTTP_POST_FILES);
if (!is_uploaded_file($HTTP_POST_FILES['file']['tmp_name'])) {
echo "The file wasn't uploaded";
unlink($HTTP_POST_FILES['file']['tmp_name']);
} else {
$maxfilesize=10240;
if ($HTTP_POST_FILES['file']['size'] > $maxfilesize) {
echo "The file was too large";
unlink($HTTP_POST_FILES['file']['tmp_name']);
} else {
if ($HTTP_POST_FILES['file']['type'] != "image/gif" AND
$HTTP_POST_FILES['file']['type'] != "image/pjpeg") {
echo "This file type isn't allowed for uploads";
unlink($HTTP_POST_FILES['file']['tmp_name']);
} else {
copy($HTTP_POST_FILES['file']['tmp_name'],"C:\\Program
Files\\Apache\\htdocs\\nef\\images\\".$HTTP_POST_FILES['file']['name']);
unlink($HTTP_POST_FILES['file']['tmp_name']);
print "File has been successfully uploaded!";
exit;
}
}
}
} else {
echo "No form submition was registered";
}
break;
}
This produces the following 3 lines of output:
upload check started
C:\php4\uploadtemp\php9223.TMP
No form submition was registered
Acording to my script this means that the receiving script couldn't
catch/access the HTTP_POST_VARS.
I'm aware that some variable names have changed, like HTTP_POST_FILES =>
$_FILES and so on, but this shouldn't affect this script since it never get
to the part with HTTP_POST_FILES.
If anyone can give me a clue to whats wrong here please let me know.
Also if you need more info about php.ini settings let me know and I'll post
it asap.
Regards
~ Aidal
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php