Uploadify随意挂100%

Mat*_*tty 8 javascript php jquery uploadify

我使用Uploadify使我的用户能够通过我的Web应用程序上传图像.

我遇到的问题是,当进度条达到100%时,它偶尔会出现(似乎是随机的),它会"挂起"并且什么都不做.

我想知道是否有任何熟悉uploadify的开发人员可能知道如何解决这个问题?我迫切需要一些帮助.

这是我的前端代码:

<javascript>
jQuery(document).ready(function() {
 jQuery("#uploadify").uploadify({
  '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)
  {
   processPersonalImage(fileObj.name);
   arrImgNames.push(fileObj.name);
   showUploadedImages(true);
   document.getElementById("photos").style.backgroundImage = "url('css/images/minicam.png')";
  },
  'onAllComplete'  : function()
  {
     completionMessage(arrFailedNames);
     document.getElementById("displayImageButton").style.display = "inline";
     document.getElementById("photos").style.backgroundImage = "url('css/images/minicam.png')";
  },
  'onCancel'  : function()
  {
     arrImgNames.push(fileObj.name);
     arrFailedNames.push(fileObj.name);
     showUploadedImages(false);
  },
  'onError'  : function()
  {
     arrImgNames.push(fileObj.name);
     arrFailedNames.push(fileObj.name);
     showUploadedImages(false);
  }
 });
});
</javascript>
Run Code Online (Sandbox Code Playgroud)

和服务器端:

 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
  move_uploaded_file($tempFile,$targetFile);
  //Now add a record to DB to reflect this personal image..
  if(file_exists($targetFile))
  {
   //add photo record to DB
   $directFilePath = $_REQUEST['folder'] . '/'.$subFolderName.'/' . $_FILES['Filedata']['name'];
   addPersonalPhotoRecordToDb($directFilePath, $row['pk']);
  }
  echo "1";
  die(true);
 }
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助!!

mhu*_*hes 2

这看起来像是一个 php 错误。我会使用 Fiddler 或类似的问题来查看 php 响应或类似的问题。检查你的 php 错误日志,它们可能会提供一些线索。