Hi,
When I use the .php3 extension I don't have any problems uploading files using the following script:
<form name="Upload" ENCTYPE="multipart/form-data" action="test.php3" method="post">
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="102400">
<INPUT TYPE="hidden" name="action" value="upload">
Upload File:
<INPUT NAME="uploadFile" TYPE="file">
<input type="submit" Value="Upload">
</form>
But when I use .php all seems to go ok, but in fact the $uploadFile variable stays empty! (also $uploadFile_name, $uploadFile_size as well as $_POST['uploadFile'] , $_POST['uploadFile']['name'] etc.) Any explanation for this?
BTW:
It's not the common register_globals_form-bug posted several times already on this forum. Other variables go perfectly.
(for example: $_POST["MAX_FILE_SIZE"]=102400
and $_POST["action"]=upload )
All other scripts work perfectly in both .php and .php3 (as long as I don't use php 4 functionality). I want to upload files AND I want to use some functionality not available in PHP3.
my latest guess is that my PHP4.2-server doesn't allow me to upload files anymore. How do I check this? My phpinfo() says:
file_uploads no value
Who will come with the solution?
Thanks a lot,
Herman
Uploading files doesn't work anymore
Moderator: General Moderators
Takuma,
What you mean by showing the php-code? the code is not the problem it's working fine, it's the variables that aren't passed which is the problem. Let me try to show you.
After I select a file using the form that I posted and having the following lines in my code:
This is the output when I run test.php3:
uploadFile=./php8n9phI
uploadFile_size=1881
uploadFile_type=image/gif
uploadFile_name=file.gif
POST uploadFile[size]=
POST uploadFile[type]=
POST uploadFile[name]=
FILES uploadFile=
FILES uploadFile[size]=
FILES uploadFile[type]=
FILES uploadFile[name]=
And this when I use the exact same script as test.php:
uploadFile=
uploadFile_size=
uploadFile_type=
uploadFile_name=
POST uploadFile=
POST uploadFile[size]=
POST uploadFile[type]=
POST uploadFile[name]=
FILES uploadFile=
FILES uploadFile[size]=
FILES uploadFile[type]=
FILES uploadFile[name]=
You see the problem? Anyway, I prefer using phpinfo() to check these variables but for this forum I thought this is more clear.
So, you have any idea what might cause this behavior? I am stuck for some days already.
Thanks a lot,
Herman
What you mean by showing the php-code? the code is not the problem it's working fine, it's the variables that aren't passed which is the problem. Let me try to show you.
After I select a file using the form that I posted and having the following lines in my code:
Code: Select all
echo("uploadFile=$uploadFile<br>\n");
echo("uploadFile_size=$uploadFile_size<br>\n");
echo("uploadFile_type=$uploadFile_type<br>\n");
echo("uploadFile_name=$uploadFile_name<br>\n");
echo("POST uploadFile=" . $_POSTї'uploadFile'] . "<br>\n");
echo("POST uploadFileїsize]=" . $_POSTї'uploadFile']ї'size'] . "<br>\n");
echo("POST uploadFileїtype]=" . $_POSTї'uploadFile']ї'type'] . "<br>\n");
echo("POST uploadFileїname]=" . $_POSTї'uploadFile']ї'name'] . "<br>\n");
echo("FILES uploadFile=" . $_FILESї'uploadFile'] . "<br>\n");
echo("FILES uploadFileїsize]=" . $_FILESї'uploadFile']ї'size'] . "<br>\n");
echo("FILES uploadFileїtype]=" . $_FILESї'uploadFile']ї'type'] . "<br>\n");
echo("FILES uploadFileїname]=" . $_FILESї'uploadFile']ї'name'] . "<br>\n");uploadFile=./php8n9phI
uploadFile_size=1881
uploadFile_type=image/gif
uploadFile_name=file.gif
POST uploadFile[size]=
POST uploadFile[type]=
POST uploadFile[name]=
FILES uploadFile=
FILES uploadFile[size]=
FILES uploadFile[type]=
FILES uploadFile[name]=
And this when I use the exact same script as test.php:
uploadFile=
uploadFile_size=
uploadFile_type=
uploadFile_name=
POST uploadFile=
POST uploadFile[size]=
POST uploadFile[type]=
POST uploadFile[name]=
FILES uploadFile=
FILES uploadFile[size]=
FILES uploadFile[type]=
FILES uploadFile[name]=
You see the problem? Anyway, I prefer using phpinfo() to check these variables but for this forum I thought this is more clear.
So, you have any idea what might cause this behavior? I am stuck for some days already.
Thanks a lot,
Herman
-
JPlush76
- Forum Regular
- Posts: 819
- Joined: Thu Aug 01, 2002 5:42 pm
- Location: Los Angeles, CA
- Contact:
it sounds like that might be the case, I do file uploads with my host and here is what my php info looks like:
have you contacted your host?
Code: Select all
file_uploads 1 1err...
Hi,
Help me understand this peculiar behaviour..
I tried the script u have posted saving it as 'uploadtest.php'. i have my register_globals set to on. when i ran the script, i got the following displayed:
uploadFile=C:\WINDOWS\TEMP\phpE0E5.TMP
uploadFile_size=49823
uploadFile_type=image/pjpeg
uploadFile_name=Flower1.jpg
POST uploadFile=
POST uploadFile[size]=
POST uploadFile[type]=
POST uploadFile[name]=
FILES uploadFile=Array
FILES uploadFile[size]=49823
FILES uploadFile[type]=image/pjpeg
FILES uploadFile[name]=Flower1.jpg
to check, i just turned my register_globals off n then ran the script. but i got absolutely no dispaly. the input form remained. i am a beginner n thus wold appreciate if u could explain the behaviour.
Thz
mh
Help me understand this peculiar behaviour..
I tried the script u have posted saving it as 'uploadtest.php'. i have my register_globals set to on. when i ran the script, i got the following displayed:
uploadFile=C:\WINDOWS\TEMP\phpE0E5.TMP
uploadFile_size=49823
uploadFile_type=image/pjpeg
uploadFile_name=Flower1.jpg
POST uploadFile=
POST uploadFile[size]=
POST uploadFile[type]=
POST uploadFile[name]=
FILES uploadFile=Array
FILES uploadFile[size]=49823
FILES uploadFile[type]=image/pjpeg
FILES uploadFile[name]=Flower1.jpg
to check, i just turned my register_globals off n then ran the script. but i got absolutely no dispaly. the input form remained. i am a beginner n thus wold appreciate if u could explain the behaviour.
Thz
mh