I have an upload script that only exists locally (it's not meant for public access). When it's done resizing the uploaded content, it moves the files to the external website via FTP.
When I upload a file that's, say, 800kb, the script takes a minute or two to process, eventually either timing out, or just finishing, but leaving me with a 0 byte file uploaded to the webhost. I tried increasing the timeout using set_time_limit() but it still doesn't make much difference.
This is the code I'm using (cut down for legibility):
Code: Select all
set_time_limit(360);
$ftp_server = "###";
$ftp_user_name = "###";
$ftp_user_pass = "###";
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// check the image is valid, then move it to local folder
include('imageresize.php');
$image = new SimpleImage();
$image->load('_img\pictureGallery\\'.$filename); // load the file we just uploaded
$image->resizeToWidth(500);
$image->save('_img\pictureGallery\full_'.$filename);
$image->resizeToWidth(86);
$image->save('_img\pictureGallery\thumb_'.$filename);
$thumbfile = "_img/pictureGallery/thumb_$filename";
$fullfile = "_img/pictureGallery/full_$filename";
$upload = ftp_put($conn_id, "htdocs/_img/pictureGallery/thumb_$filename", $thumbfile, FTP_BINARY);
$upload2 = ftp_put($conn_id, "htdocs/_img/pictureGallery/full_$filename", $fullfile, FTP_BINARY);
Anything obvious here?
Cheers
Matt