views:

26

answers:

2

Hi there,

I am using a script to upload photo (written by my own) which allow user to select more than 1 files, using Flash. When user click upload, as3 will post the upload file to upload.php, resize it, and save it one by one.

The problem: In production server, if I am uploading many photos and the photos size are very large, >2MB, the uploading progress just stuck in halfway, only the first few photos successfully uploaded.

What I have found out: If I tried with smaller size photos, or if I disabled the resizing script in upload.php, there are no problem at all.Furthermore, the script work fine in my localhost with newer processor compared to the problematic server with older model)

The resize script is simple. It just check whether the image resolution is large, and use imagecopyresampled() to resize the image if needed.

I tried to unset image resource in upload.php to free up memory but it doesn't help. What else could be the problem?

+1  A: 

If I remember right, there is a 2mb upload limit in php, you can change it in the php.ini file.

__dominic
from: http://www.kavoir.com/2010/02/php-get-the-file-uploading-limit-max-file-size-allowed-to-upload.html$max_upload = (int)(ini_get('upload_max_filesize'));$max_post = (int)(ini_get('post_max_size'));$memory_limit = (int)(ini_get('memory_limit'));$upload_mb = min($max_upload, $max_post, $memory_limit);
Casey
no, this isn't the problem.The problem only happens if I upload "many files with large size".
neobie
A: 

I solved the problem.

It happens when I use code like this in AS3:

for(var i:Number = 0; i< fileList.length; i++) {
    fileList[i].upload(new URLRequest(param.uploadURL+"&sessionid="+param.session_id));
}

The code seems like pushing upload.php script in very tedious way.

I made changes to both my AS3 and JS, so that JS call to AS3 upload() function only everytime a file upload is completed (from event listener EVENT.COMPLETE)

By making so, AS3 wont call for upload.php synchronously for multiple files. Instead, it wait for a file completed the upload, then call for another upload for the next file.

neobie