Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP Uploading Woes

Status
Not open for further replies.

MrPantsTm

Programmer
Joined
Jan 22, 2004
Messages
71
Location
US
I'm doing a page that allows people in my group to upload files to our server and I seem to be running into a snag.

For small files (I haven't pinpointed the size yet but around a 2 megs I'd say) it uploads no problem, everythings happy. But on larger files, almost instantaneously I get a "Cannot Find Server" page. I've gutted the form call (I'm using PHP) to see if it was something in the code I'm using, so when the button is pressed, nothing should happen atleast in terms of PHP code. Again, in the small files nothing happens as expected but on the bigger files I get "Cannot Find Server". This leads me to believe it has something to do with the server but I'm not sure where to look. I've taken out any calls to check for file sizes.

Some Details:

Server: Linux

Form:

<form action=&quot;/upload.php&quot; method=&quot;post&quot;
enctype=&quot;multipart/form-data&quot;>
<p> Select a Document to upload:</p>
<input type=&quot;file&quot; name=&quot;uploadedfile&quot; size=&quot;60&quot; />
<p><input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Submit&quot; /></p>
<p><input type=&quot;reset&quot; name=&quot;reset&quot; value=&quot;Reset&quot; /></p>
</form>

I've edited php.ini, php.conf in the apache directory, extending any number that has anything remotely to do with file uploads to 10 times what is used to be.

Anyone else have this problem or have any ideas?


 
sleipnir214
I believe he's talking about Apache, however, no version number is available.

MrPansTm
Have you checked in the temporary location for HTTP uploads (probably /var/tmp/) if the file or portions of it were transferred?
Is there a httpd in the process list that still runs when the browser quits?
 
DRJ478:
You're right -- it's Apache. The line which reads in part &quot;in the apache directory&quot; is the giveaway.


All:
Apache 2.x has a configuration directive LimitRequestBody which limits the number of bytes you can upload. Could that be it?


Want the best answers? Ask the best questions: TANSTAAFL!!
 
sleipnir214 (Programmer) Jan 30, 2004
That sounds like a catch-all IE error. Have you tried using another web browser that gives more meaningful error messages?

I just tried Mozilla and it uploads the smaller files fine. On the larger files it just stares at me. Nothing happens when I press the button.

What web server are we talking about?

Apache 2.0


Apache 2.x has a configuration directive LimitRequestBody which limits the number of bytes you can upload. Could that be it?

I've checked that and I've increased the size to 52428800..

DRJ478 (IS/IT--Manageme)

Have you checked in the temporary location for HTTP uploads (probably /var/tmp/) if the file or portions of it were transferred?

I just checked the directory php told me it is saving temporary files to although I did not see any temporary files in there which gives me pause.

Is there a httpd in the process list that still runs when the browser quits?

I don't believe so.


 
2 more places to explore :

php.ini (/etc/php.ini)

; Maximum allowed size for uploaded files.
upload_max_filesize = 2M

httpd.conf (/etc/httpd/conf/httpd.conf)

# Timeout: The number of seconds before receives and sends time out.
#
TimeOut 300


______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
*note :
TimeOut 300 is normally 30 but I had problems uploading about 60 meg, so I had to make mine more :-)

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
php.ini (/etc/php.ini)

; Maximum allowed size for uploaded files.
upload_max_filesize = 2M


upload_max_filesize = 600M

[/i]httpd.conf (/etc/httpd/conf/httpd.conf)

# Timeout: The number of seconds before receives and sends time out.
#
TimeOut 300[/i]

TimeOut 30000

If it helps, its not waiting to give me the error. In IE its instant, right after I hit the button it says can't find page. In Mozilla, it just doesn't do anything (that I can tell from looking).
 
long shot but have you tried hitting CTRL+F5 .. woindering if its windoze caching the error page for a given file ..

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
no, it just brought me back to the homepage. This is frustrating.

Thank you for your help :)
 
<form action=&quot;/upload.php&quot; method=&quot;post&quot;
check to see if the filepath is correct. if you have already changed the file upload size and timeout, there really isn't much more. also, try checking the permissions on the tmp folder

David Kuhn
<a href=&quot; target=&quot;_blank&quot;>
 
<b>sleipnir214</b> - I tried Mozilla in Linux and when I press the button on large files in just stairs at me. Nothing happens at all or atleast the browser gives no indication that it is doing anything.


<b>dpk136</b> - I have &quot;/upload.php&quot; as <?=$_SERVER['PHP_SELF']?>&quot;. Do you see any value in having it go to another page to do the upload or should it just work fine being on the same page? I've done it before this way on my other system at home (admittely a windows box) with no problems. although at this rate I'll willing to try anything.

I've changed the permissions and even changed the tmp path that php uploads to.

thanks!
 
well it seems like I've partially solved my problem. It seems I was editing the wrong config files.

However, I still have a problem. I've changed php.conf > LimitRequestBody to 52428800. This solved the &quot;Cannot Display Page problem&quot; but now it seems that the file upload part does not work. I echo $_FILES['uploadedfile']['name'] to see if that works but nothing appears. I echo &quot;Hello World&quot; and that comes up. Nothing seems to be happening to my databases nor are files being uploaded. Did I make the size to big? Thanks!
 
when you upload using php, it uploads to a tmp directory. so you have to move the file from the temp directory to the one that you want it to be in. check your code to see if you have a copy statement or something like that.

David Kuhn
------------------
 
I think I solved it. Thanks for all your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top