Home » Php » php – Uploadify Hanging at random on 100%

php – Uploadify Hanging at random on 100%

Posted by: admin July 12, 2020 Leave a comment


I am using Uploadify to enable my users to upload images via my web application.

The problem I am having is that every now and then (at what appears to be random) when the progress bar reaches 100% it ‘hangs’ and does nothing.

I was wondering if any developers familiar with uploadify may have any idea how to solve this? I am in desperate need of some help.

Here is my front-end code:

jQuery(document).ready(function() {
  'uploader'       : 'javascripts/uploadify.swf',
  'script'         : 'upload-file2.php',
  'cancelImg'      : 'css/images/cancel.png',
  'folder'         : 'uploads/personal_images/' + profileOwner,
  'queueID'        : 'fileQueue',
  'auto'           : true,
  'multi'          : true,
  'fileDesc'       : 'Image files',
     'fileExt'        : '*.jpg;*.jpeg;*.gif;*.png',
  'sizeLimit'      : '2097152',
  'onComplete': function(event, queueID, fileObj, response, data)
   document.getElementById("photos").style.backgroundImage = "url('css/images/minicam.png')";
  'onAllComplete'  : function()
     document.getElementById("displayImageButton").style.display = "inline";
     document.getElementById("photos").style.backgroundImage = "url('css/images/minicam.png')";
  'onCancel'  : function()
  'onError'  : function()

And server side:

 if (!empty($_FILES)) 
  //Get user ID from the file path for use later..
  $userID = getIdFromFilePath($_REQUEST['folder'], 3); 
  $row = mysql_fetch_assoc(getRecentAlbum($userID, "photo_album_personal"));
  $subFolderName = $row['pk'];
     //Prepare target path / file..
  $tempFile = $_FILES['Filedata']['tmp_name'];
  $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/'.$subFolderName.'/';
  $targetFile =  str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
  //Move uploaded file from temp directory to new folder
  //Now add a record to DB to reflect this personal image..
   //add photo record to DB
   $directFilePath = $_REQUEST['folder'] . '/'.$subFolderName.'/' . $_FILES['Filedata']['name'];
   addPersonalPhotoRecordToDb($directFilePath, $row['pk']);
  echo "1";

thanks for any help!!

How to&Answers:

this seems like a php error.
I’d use Fiddler or a similar problem to view the php response or similar.
Check your php error logs, they might shed some light.


I had a similar problem some time ago with Uploadify (using ASP.Net MVC though) – but you will definitely find some useful info regarding the Uploadify event handling and behaviour in the answer posted! Its available here


I had the same problem.
Simply add echo "astlavista babi" to your uploadify script, this echo statement should be the last line, if you have conditional statement then echo should be placed as a last line within the conditional statement.


These are the steps I would take, in order:

1) Be 100% certain you are getting a 200 response from your server. If not, that is the problem

2) Use the latest and the greatest uplaodify and jquery

3) Check for JS errors (firebug console or browser JS debugger will work)

4) Upgrade your Flash player (if that solves it then you can require a higher version)

5) Put a debug statements in the uploadify source, specifically in the complete handler to be sure it gets called

6) If the progress is reaching 100% but the handler never gets called, I’m afraid the next step may be to dive into the actionscript and use the debugger or some trace statements to figure out where the error is. This can mean that there is a bug in calling the external interface function

7) If you make fixes, submit back to uploadify


Chreck your php.ini file for post_max_size parameter. It must be >= upload_max_filesize parameter. For more details see http://php.net/post-max-size.


For future reference: I had this problem when sending data to the upload script using “scriptData” and solved it by simply echoing “ok” in the upload script rather than sending back an empty document.


For those who are using Macs use HTTP Scoop to view the request as Firebug does not show it. More on HTTP Scoop from this blog.