NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP Fileupload problem

Jeff Siegel jeff987654 at yahoo.com
Wed Jul 22 12:44:52 EDT 2009


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