0

首先,我在本地服务器上工作,xampp,jquery uploadify 只上传一个文件,其他文件在 100% 上,并保持这样。当单击 x 按钮停止时,我收到此消息:'未捕获的异常:Actionscript 中的错误'? ? 有什么想法吗?这是 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);

    }
4

1 回答 1

1

您的自定义onComplete侦听器必须return true允许 Uploadify 在其文件上传完成后删除队列项目。

红色的“x”按钮取消上传。当您单击它时,您是在告诉 Uploadify 的 Flash 上传器停止上传相关文件。Flash 抛出错误,因为它被告知取消已完成的文件上传。

如果您不希望文件在完成上传后从队列中消失(当自定义 onComplete 侦听器返回 true 时会发生这种情况),您必须删除或替换取消按钮或其事件侦听器。

于 2010-07-12T00:30:38.043 回答