【发布时间】:2010-06-01 08:04:02
【问题描述】:
首先,我在本地服务器上工作,xampp,jquery uploadify 只上传一个文件,其他文件在 100% 上,并保持这种状态。当单击 x 按钮停止时,我收到此消息:'未捕获的异常:错误动作脚本' ??有什么想法吗?这是 wordpress 项目。 我的代码:
uploadifyObj={
uploader : '<?php echo $full_path_ajax_swf_dir; ?>',
script : '<?php echo $full_path_ajax_php; ?>',
scriptData : {'extra' : '5'},
cancelImg : '<?php echo WP_PLUGIN_URL . '/' . $plugin_dir_name.'/iks.png';?>',
folder : 'path',
queueID : 'fileQueue',
auto : true,
multi : true,
method : 'GET',
fileDesc: 'Image files',
fileExt : '*.jpg;*.jpeg;*.png',
buttonText : 'Choose...',
simUploadLimit: 20,
onComplete : function(event, queueID, fileObj, response, data) {
alert(response);
},
onError : function(event,queueID, fileObj){
alert(event);
},
onAllComplete : function(event, data){
alert('Everything is over')l
}
};
$("#uploadify").uploadify(uploadifyObj);
和php部分:
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = WP_CONTENT_DIR. '/uploads/'.$plugin_dir_name.'/'. get_option('myFolder') .'/';
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
$jsonResponse->msg = $targetFile;
move_uploaded_file($tempFile,$targetFile);
/*
if(!file_exists($targetFile)) {
move_uploaded_file($tempFile,$targetFile);
$jsonResponse->msg = 'file dont exist';
}
else{
$jsonResponse->msg = 'file exist : '.$_FILES['Filedata']['name'];
} */
print json_encode($jsonResponse);
}
【问题讨论】:
-
那个 php 文件的文件名是什么?这个 (
$full_path_ajax_php) 有吗? -
文件名是 do_job 并且是 do_job.php 文件的完整路径
-
$full_path_ajax_php = WP_PLUGIN_URL 。 '/' 。 $plugin_dir_name 。 '/do_job.php';
-
这是错字吗?
onAllComplete : function(event, data){ alert('Everything is over')l }警报后有事... -
错字,对不起,我只是尝试在我的本地服务器上上传示例,并且工作正常,没有错误。 :( 问题出在哪里?有什么想法吗?
标签: jquery wordpress uploadify