pakenney38 Posted August 15, 2006 Share Posted August 15, 2006 I wrote a PHP script to process a form that is used to upload 20+ files to a folder on my web server, but for some reason when the script page tries to load with more than 2 files uploaded the browser displays "The Page Cannot Be Displayed." This [b]only[/b] happens when the form attempts to pass more than 2 files to upload. Quote Link to comment Share on other sites More sharing options...
ryanlwh Posted August 15, 2006 Share Posted August 15, 2006 have you tried 20 small files (a total of less than 1M)?? if you can successfully upload these small files, then it's probably a setting in apache that caused the problem. Quote Link to comment Share on other sites More sharing options...
pakenney38 Posted August 15, 2006 Author Share Posted August 15, 2006 [quote author=ryanlwh link=topic=104398.msg416380#msg416380 date=1155671708]have you tried 20 small files (a total of less than 1M)?? if you can successfully upload these small files, then it's probably a setting in apache that caused the problem.[/quote]Good call. I just tried uploading 20 4KB text files and they go through just fine, so I will take a look at Apache and come back with an answer for anyone who is interested. Quote Link to comment Share on other sites More sharing options...
pakenney38 Posted August 16, 2006 Author Share Posted August 16, 2006 So I've got 1 setting in apache "LimitRequestBody" that by default is set to 0, which allows unlimited HTTP request in the body, which is where form data would be passed. I intentionally tried forcing a setting of 0 in my httpd.conf and restarted apache, and nothing changed.I am running my PHP server in Fedora Core 5, but I am pretty sure that php.ini still controls many of the settings for php. Two of them that control file upload limit are post_max_size and upload_max_filesize. These were set to something insanely small like 2M. So post_max_size is now 250M and upload_max_filesize is 200M. After making this change, I again restarted apache so that it would reload the php module and process the new php.ini. The original problem persists. I am at a loss. Quote Link to comment Share on other sites More sharing options...
karthikeyan_coder Posted August 16, 2006 Share Posted August 16, 2006 [quote]## Timeout: The number of seconds before receives and sends time out.#Timeout [/quote]in httpd.confand[quote];;;;;;;;;;;;;;;;;;;; Resource Limits ;;;;;;;;;;;;;;;;;;;;max_execution_time = 300000 ; Maximum execution time of each script, in secondsmax_input_time = 6000 ; Maximum amount of time each script may spend parsing request datamemory_limit = 8M ; Maximum amount of memory a script may consume (8MB)[/quote]in php.iniCheck those vars. Quote Link to comment Share on other sites More sharing options...
pakenney38 Posted August 16, 2006 Author Share Posted August 16, 2006 Timeout 120max_execution_time = 30max_input_time = 60memory_limit = 64M <-- I changed this recently just to try something new.Please note that "The Page Cannot Be Displayed" shows up within 4 seconds.I have discovered that I can upload more than two files now. All total, I can't do more than 3-4MB though, otherwise "The Page Cannot Be Displayed."Again:post_max_size 250upload_max_filesize 200 Quote Link to comment Share on other sites More sharing options...
karthikeyan_coder Posted August 16, 2006 Share Posted August 16, 2006 1. is it allowing single file uploads..2. Is your webserver crashes after this try?3. Can you run other scripts after the output "The page cannot be displayed"4. just refresh the same page after getting the error..Answer me for these questions Quote Link to comment Share on other sites More sharing options...
pakenney38 Posted August 16, 2006 Author Share Posted August 16, 2006 [quote author=karthikeyan_coder link=topic=104398.msg416986#msg416986 date=1155756611]1. is it allowing single file uploads..2. Is your webserver crashes after this try?3. Can you run other scripts after the output "The page cannot be displayed"4. just refresh the same page after getting the error..Answer me for these questions[/quote]1. Yes and No, nothing larger than 3-4MB.2. No.3. Yes.4. Refreshing the PHP page results in "The Page Cannot Be Displayed." However, I can go back to the upload form and load that page.Here is the HTML Form:[code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>File Upload Form</title></head><body><form enctype="multipart/form-data" action="procupload.php" method="POST"> <p align="center"><img src="../picts/logonospace.JPG" alt="gojet" width="399" height="132" /><br /> <strong><font face="Arial, Helvetica, sans-serif">FILE UPLOAD</font></strong><br /> </p> <p align="center"><font face="Arial, Helvetica, sans-serif"><strong>Instructions</strong>: Click Browse to find and add each file to upload.<br /> If you do not want to include one or more files, don't click Browse for the appropriate documents. Just leave those fields blank.<br /> When you have finished adding all appropriate documents click the Uploads Files.</font></p> <p align="center"><strong><font size="2" face="Arial, Helvetica, sans-serif">GoJet Manuals Revisions</font></strong> <input name="uploadedfile" type="file" /> </p> <hr /> <div align='center'> <table width="780" border="0"> <tr bgcolor="#CCCCCC"> <td width="355"><strong><font size="2" face="Arial, Helvetica, sans-serif">Company Drug and Alcohol Program </font></strong></td> <td width="415"><p> <input name="uploadedfile2" type="file" /></p> </td> </tr> <tr> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">Crew Records Policies and Procedures </font></strong></td> <td><input name="uploadedfile22" type="file" /></td> </tr> <tr bgcolor="#CCCCCC"> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">Crew Scheduling Policies and Procedures </font></strong></td> <td><input name="uploadedfile23" type="file" /></td> </tr> <tr> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">External Walkaround Checklist </font></strong></td> <td><input name="uploadedfile24" type="file" /></td> </tr> <tr bgcolor="#CCCCCC"> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">Normal Checklist </font></strong></td> <td><input name="uploadedfile25" type="file" /></td> </tr> <tr> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">Takeoff and Landing Speed Book </font></strong></td> <td><input name="uploadedfile26" type="file" /></td> </tr> <tr bgcolor="#CCCCCC"> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">Customer Service Policies and Procedures </font></strong></td> <td><input name="uploadedfile27" type="file" /></td> </tr> <tr> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">Dispatch Policies and Procedures Manual </font></strong></td> <td><input name="uploadedfile28" type="file" /></td> </tr> <tr bgcolor="#CCCCCC"> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">Flight Attendant Training Manual </font></strong></td> <td><input name="uploadedfile29" type="file" /></td> </tr> <tr> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">Flight Operations Training Dept. Policies and Procedures </font></strong></td> <td><input name="uploadedfile211" type="file" /></td> </tr> <tr bgcolor="#CCCCCC"> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">Flight Operations Training Manual Vol. 1 </font></strong></td> <td><input name="uploadedfile212" type="file" /></td> </tr> <tr> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">Flight Operations Training Manual Vol. 2 </font></strong></td> <td><input name="uploadedfile213" type="file" /></td> </tr> <tr bgcolor="#CCCCCC"> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">Flight Operations Training Manual Vol. 3 </font></strong></td> <td><input name="uploadedfile214" type="file" /></td> </tr> <tr> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">General Operations Manual </font></strong></td> <td><input name="uploadedfile215" type="file" /></td> </tr> <tr bgcolor="#CCCCCC"> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">General Maintenance Manual Vol. 1 </font></strong></td> <td><input name="uploadedfile216" type="file" /></td> </tr> <tr> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">General Maintenance Manual Vol. 2 </font></strong></td> <td><input name="uploadedfile217" type="file" /></td> </tr> <tr bgcolor="#CCCCCC"> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">General Maintenance Manual Vol. 4 </font></strong></td> <td><input name="uploadedfile218" type="file" /></td> </tr> <tr> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">Inflight Service Policies and Procedures Manual </font></strong></td> <td><input name="uploadedfile219" type="file" /></td> </tr> <tr bgcolor="#CCCCCC"> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">Inflight Training Policies and Procedures Manual </font></strong></td> <td><input name="uploadedfile220" type="file" /></td> </tr> <tr> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">Maintenance Training Manual </font></strong></td> <td><input name="uploadedfile2212" type="file" /></td> </tr> <tr bgcolor="#CCCCCC"> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">Minimum Equipment List </font></strong></td> <td><input name="uploadedfile221" type="file" /></td> </tr> <tr> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">Run and Taxi Manual </font></strong></td> <td><input name="uploadedfile222" type="file" /></td> </tr> <tr bgcolor="#CCCCCC"> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">Safety/Regulatory Compliance Manual </font></strong></td> <td><input name="uploadedfile223" type="file" /></td> </tr> <tr> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">Special Procedures (SP) General Manual </font></strong></td> <td><input name="uploadedfile224" type="file" /></td> </tr> <tr bgcolor="#CCCCCC"> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">Standard Operating Procedures </font></strong></td> <td><input name="uploadedfile225" type="file" /></td> </tr> <tr> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">System Administration Manual </font></strong></td> <td><input name="uploadedfile226" type="file" /></td> </tr> <tr bgcolor="#CCCCCC"> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">Trauma Response Manual </font></strong></td> <td><input name="uploadedfile227" type="file" /></td> </tr> <tr> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">Vendor Line Service Manual </font></strong></td> <td><input name="uploadedfile228" type="file" /></td> </tr> <tr bgcolor="#CCCCCC"> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">Winter Operation Ground Icing Program </font></strong></td> <td><input name="uploadedfile229" type="file" /></td> </tr> </table> </div> <p align="center"> <input type="submit" value="Upload Files" /> </p></form></body></html>[/code]Here is the PHP Page that processes the form:[code]<?PHP$target_path = "/uploads/";$newfilename = "REV.pdf";$target_path0 = $target_path . $newfilename; $newfilename1 = "DAPM.pdf";$target_path1 = $target_path . $newfilename1; $newfilename2 = "CRPP.pdf";$target_path2 = $target_path . $newfilename2; $newfilename3 = "CRWS.pdf";$target_path3 = $target_path . $newfilename3; $newfilename4 = "XCHK.pdf";$target_path4 = $target_path . $newfilename4; $newfilename5 = "NCHK.pdf"; $target_path5 = $target_path . $newfilename5; $newfilename6 = "SPEED.pdf";$target_path6 = $target_path . $newfilename6; $newfilename7 = "CSPP.pdf";$target_path7 = $target_path . $newfilename7; $newfilename8 = "DPPM.pdf";$target_path8 = $target_path . $newfilename8; $newfilename9 = "FATM.pdf";$target_path9 = $target_path . $newfilename9; $newfilename10 = "FTPP.pdf";$target_path10 = $target_path . $newfilename10; $newfilename11 = "FOTM1.pdf";$target_path11 = $target_path . $newfilename11; $newfilename12 = "FOTM2.pdf";$target_path12 = $target_path . $newfilename12; $newfilename13 = "FOTM3.pdf";$target_path13 = $target_path . $newfilename13; $newfilename14 = "GOM.pdf";$target_path14 = $target_path . $newfilename14;$newfilename15 = "GMM1.pdf";$target_path15 = $target_path . $newfilename15; $newfilename16 = "GMM2.pdf";$target_path16 = $target_path . $newfilename16; $newfilename17 = "GMM4.pdf";$target_path17 = $target_path . $newfilename17; $newfilename18 = "ISPP.pdf";$target_path18 = $target_path . $newfilename18; $newfilename19 = "ITPP.pdf";$target_path19 = $target_path . $newfilename19; $newfilename20 = "MXTM.pdf";$target_path20 = $target_path . $newfilename20; $newfilename21 = "MEL.pdf";$target_path21 = $target_path . $newfilename21; $newfilename22 = "RATM.pdf";$target_path22 = $target_path . $newfilename22; $newfilename23 = "SAFE.pdf";$target_path23 = $target_path . $newfilename23; $newfilename24 = "SPG.pdf";$target_path24 = $target_path . $newfilename24; $newfilename25 = "SOP.pdf";$target_path25 = $target_path . $newfilename25; $newfilename26 = "SAM.pdf";$target_path26 = $target_path . $newfilename26; $newfilename27 = "TRM.pdf";$target_path27 = $target_path . $newfilename27; $newfilename28 = "VLSM.pdf";$target_path28 = $target_path . $newfilename28; $newfilename29 = "WOP.pdf";$target_path29 = $target_path . $newfilename29; if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path0)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile2']['tmp_name'], $target_path1)) { echo "The file ". basename( $_FILES['uploadedfile2']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename1, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile22']['tmp_name'], $target_path2)) { echo "The file ". basename( $_FILES['uploadedfile22']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename2, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile23']['tmp_name'], $target_path3)) { echo "The file ". basename( $_FILES['uploadedfile23']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename3, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile24']['tmp_name'], $target_path4)) { echo "The file ". basename( $_FILES['uploadedfile24']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename4, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile25']['tmp_name'], $target_path5)) { echo "The file ". basename( $_FILES['uploadedfile25']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename5, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile26']['tmp_name'], $target_path6)) { echo "The file ". basename( $_FILES['uploadedfile26']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename6, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile27']['tmp_name'], $target_path7)) { echo "The file ". basename( $_FILES['uploadedfile27']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename7, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile28']['tmp_name'], $target_path8)) { echo "The file ". basename( $_FILES['uploadedfile28']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename8, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile29']['tmp_name'], $target_path9)) { echo "The file ". basename( $_FILES['uploadedfile29']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename9, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile211']['tmp_name'], $target_path10)) { echo "The file ". basename( $_FILES['uploadedfile211']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename10, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile212']['tmp_name'], $target_path11)) { echo "The file ". basename( $_FILES['uploadedfile212']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename11, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile213']['tmp_name'], $target_path12)) { echo "The file ". basename( $_FILES['uploadedfile213']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename12, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile214']['tmp_name'], $target_path13)) { echo "The file ". basename( $_FILES['uploadedfile214']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename13, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile215']['tmp_name'], $target_path14)) { echo "The file ". basename( $_FILES['uploadedfile215']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename14, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile216']['tmp_name'], $target_path15)) { echo "The file ". basename( $_FILES['uploadedfile216']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename15, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile217']['tmp_name'], $target_path16)) { echo "The file ". basename( $_FILES['uploadedfile217']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename16, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile218']['tmp_name'], $target_path17)) { echo "The file ". basename( $_FILES['uploadedfile218']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename17, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile219']['tmp_name'], $target_path18)) { echo "The file ". basename( $_FILES['uploadedfile219']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename18, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile220']['tmp_name'], $target_path19)) { echo "The file ". basename( $_FILES['uploadedfile220']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename19, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile2212']['tmp_name'], $target_path20)) { echo "The file ". basename( $_FILES['uploadedfile2212']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename20, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile221']['tmp_name'], $target_path21)) { echo "The file ". basename( $_FILES['uploadedfile221']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename21, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile222']['tmp_name'], $target_path22)) { echo "The file ". basename( $_FILES['uploadedfile222']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename22, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile223']['tmp_name'], $target_path23)) { echo "The file ". basename( $_FILES['uploadedfile223']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename23, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile224']['tmp_name'], $target_path24)) { echo "The file ". basename( $_FILES['uploadedfile224']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename24, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile225']['tmp_name'], $target_path25)) { echo "The file ". basename( $_FILES['uploadedfile225']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename25, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile226']['tmp_name'], $target_path26)) { echo "The file ". basename( $_FILES['uploadedfile226']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename26, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile227']['tmp_name'], $target_path27)) { echo "The file ". basename( $_FILES['uploadedfile227']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename27, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile228']['tmp_name'], $target_path28)) { echo "The file ". basename( $_FILES['uploadedfile228']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename28, please try again! <br>";}if(move_uploaded_file($_FILES['uploadedfile229']['tmp_name'], $target_path29)) { echo "The file ". basename( $_FILES['uploadedfile229']['name']). " has been uploaded <br>";} else{ echo "There was an error uploading $newfilename29, please try again! <br>";}?>[/code]I posted this code when asking about another issue, but there have not been any changes to the code since then. Quote Link to comment Share on other sites More sharing options...
ryanlwh Posted August 16, 2006 Share Posted August 16, 2006 the limit from php.ini wouldn't give you "This page cannot be displayed"..Have you tried it in Firefox?What's your version of apache?I'd also recommend you to use the array notation for hte files[code]<input type="file" name="uploadedfile[]">[/code][code] for($i=0;$i<=29;$i++){ if(move_uploaded_file($_FILES['uploadedfile'][$i]['tmp_name'].$target_path[$i])) { ... } ...}[/code] Quote Link to comment Share on other sites More sharing options...
Exussum Posted August 16, 2006 Share Posted August 16, 2006 i dont know if it would help - but using a for or while loop would decrease the processeing page File length. Quote Link to comment Share on other sites More sharing options...
pakenney38 Posted August 18, 2006 Author Share Posted August 18, 2006 Last night the network admin restarted my web server while he was moving some stuff around and my form started working. Strange. Just for future reference, what related Linux services should I be restarting when I make changes other than httpd? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.