homepage Welcome to WebmasterWorld Guest from 174.129.80.166
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
PHP Upload Form Problems
Small 4k files work fine, large ones do not even have a temp path
scratch




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

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
";

 

jatar_k




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

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.

transistor




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

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




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

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

transistor




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

Hmm... sorry to hear that...

I suggest you leave the max_execution_time to 30 in php.ini, and use set_time_limit(0) in your upload script instead.
Safe practise.

Let us know if you succeed.

scratch




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

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.

transistor




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

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved