Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP Upload Form Problems

Small 4k files work fine, large ones do not even have a temp path



5:08 am on Oct 23, 2002 (gmt 0)

10+ Year Member

A. PHP.ini Max size, memory max and max upload are all at about 200 megs (to rule out any issues)
B. Upload form is set to accept about 100 megs
C. Time out is set to 9000 seconds in PHP.ini and IIS
D. I am using windows 2000 Server and IIS and php 4.23

I added debugging code to my code that catches the file. It shows the actual variables my script will use. This is what it shows for a 4k text file.

C:\PHP\uploadtemp\php3F.tmp=temporary path
115=total size
files.ini=true name

However when i upload a 284k text file.

=temporary path
0=total size
dlrose.cgi=true name

I have had errors on files as small as 28k

Why is it now not working?

This is the excerpt of my debugging code.
I am pretty sure it is right because it works for the small files.
It looks like the temp directory is fine with permissions open for everyone.

Echo "<BR><BR><BR>Debugging data<BR>
<BR>".$HTTP_POST_FILES['userfile']['tmp_name']."=temporary path
<BR>".$HTTP_POST_FILES['userfile']['size']."=total size
<BR>".$HTTP_POST_FILES['userfile']['name']."=true name


2:45 pm on Oct 23, 2002 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Have to admit I'm not too sure scratch. If it works for small files it should work for large ones. My only guess is some server problem but nothing jumps out at me.

Maybe this bump will help.


4:27 pm on Oct 23, 2002 (gmt 0)

10+ Year Member

Hello Scratch,
have you checked the
It is in the File Uploads section in the php.ini file (note that it is different from the


6:56 pm on Oct 23, 2002 (gmt 0)

10+ Year Member

This is what i currently have set in my php.ini that seems to be relevant. I think i am going to try replacing the php.ini with a clean original and see if that helps.

upload_max_filesize = 999999999
file_uploads = On
upload_tmp_dir = C:\PHPUPTMP\
; also tried C:\PHPUPTMP
; and C:\PHP\uploadtemp
max_execution_time = 9000
memory_limit = 999999999
post_max_size = 999999999

;what does this do (seems to work better Off, tried both)
always_populate_raw_post_data = Off

;Every where that i have 999999999 i also have tried 100M and 20M


7:16 pm on Oct 23, 2002 (gmt 0)

10+ Year Member

Hmm... sorry to hear that...

I suggest you leave the

to 30 in php.ini, and use
in your upload script instead.
Safe practise.

Let us know if you succeed.


8:29 pm on Oct 23, 2002 (gmt 0)

10+ Year Member

Yeah, i have it all set at enourmous numbers for now.
Thanks for the tip on setting the time limit on a script by script basis, i will definitely do that, did not know that was there.

I also managed to fix it by using a clean copy of php.ini, the recomended one. Not really sure what happened to it but it was the cause. I also got it to upload 30 megs with a set limit of 120M.

As far as i can tell it was using its 4k cache to upload the files instead of putting it in the upload temp directory. At least that is the only reason i can think that small files under 4k were working.

Does anyone know how php handles multiple large uploads. Are they all put in memory.

Anyway, thanks all for the help.


10:35 pm on Oct 24, 2002 (gmt 0)

10+ Year Member

Well done!

About those multiple uploads, I've done it with up to 12 files, each 3 or 4 MB and I didn't like how much it took to upload and I decided to use SFTP or SSH to upload the files and then use a web-based interface to put them in the database and in the directory they belong to.

Now I have File Uploads turned off.
Just an idea.


Featured Threads

Hot Threads This Week

Hot Threads This Month