RE: [PHP-WIN] HTTP_POST_VARS - need help
| From: | Asendorf, John | Date: | Wed, 23 Oct 2002 12:28:31 +0000 |
| Subject: | RE: [PHP-WIN] HTTP_POST_VARS - need help | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-16494@lists.php.net to get a copy of this message | ||
Your action in the form may be the problem...
I think you need action=\"$PHP_SELF\" instead of action=\"$PHSELF\"
---------------------
John Asendorf - jasendorf@lcounty.com
Web Applications Developer
http://www.lcounty.com - NEW FEATURES ADDED DAILY!
Licking County, Ohio, USA
740-349-3631
Nullum magnum ingenium sine mixtura dementiae fuit
> -----Original Message-----
> From: Aidal [mailto:aidal@nospam.dk]
> Sent: Wednesday, October 23, 2002 5:28 AM
> To: php-windows@lists.php.net
> Subject: [PHP-WIN] HTTP_POST_VARS - need help
>
>
> 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
>