NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP Fileupload problem

Dan Cech dcech at phpwerx.net
Wed Jul 22 13:03:29 EDT 2009


Jeff,

You may be falling afoul of one of the configuration options related to
file uploads in PHP:

	upload_max_filesize "128M"
	post_max_size "50M"
	max_input_time 600

Or Apache:

	LimitRequestBody 53000000

The settings above are usually sufficient to allow uploads up to 40MB+,
assuming the client is able to upload fast enough to complete the upload
in under 10 minutes.

Dan

Jeff Siegel wrote:
> The code is real standard stuff (see below). A user selects a file.
> Clicks upload. When the upload is completed a refreshed page appears.
> This function works perfectly when I test it and when another
> consultant tests it. We are able to upload files of almost any size.
> When the upload is complete we see the new refreshed page and the
> uploaded file is in the correct directory. Of course...this does not
> work  when the client does the uploading. The browser seems to time
> out when the file is about 1 meg or greater in size. There are no PHP
> errors, no PHP timeout errors. Just the browser saying that the page
> cannot be displayed.
> 
> I tried the script running off of two different web hosts. It works
> for me. It works for the consultant. It doesn't work for the client.
> To make matters worse, the client's client has the same problem
> uploading files.
> 
> Any thoughts on where else to look? Maybe I'm overlooking something
> that is real obvious.
> 
> Jeff --------------
> 
> function UploadFile($IVF){
> 
> if($IVF){ $uploaddir = '/home/thisdirectory/'; $newFileName =
> RenameFile(trim($_POST['claimantname'])); $uploadfile = $uploaddir .
> $newFileName; } else { $uploaddir = '/home/thatdirectory/'; 
> $newFileName = RenameFile(trim($_SESSION['claimant'])); $uploadfile =
> $uploaddir . $newFileName; }
> 
> if(is_uploaded_file($_FILES['userfile']['tmp_name'])){ 
> if(move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)){
>  return 1;
> 
> } else { return 0; } } else { return 0; } }



More information about the talk mailing list