开发者

Jquery uploadify just one file upload and other upload stay at 100%?

开发者 https://www.devze.com 2023-01-01 12:56 出处:网络
first,I work on localserver,xampp,jquery uploadify just upload one file,and other files are on 100%,and stay like that.When click on x button to stopI get this message : \'uncaught exception: Error in

first,I work on localserver,xampp,jquery uploadify just upload one file,and other files are on 100%,and stay like that.When click on x button to stop I get this message : 'uncaught exception: Error in Actionscript' ?? Any 开发者_开发知识库idea?This is wordpress project. my code :

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);

and php part :

 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);

    }


Your custom onComplete listener must return true to allow Uploadify to remove a queue item once its file upload has completed.

The red "x" button cancels an upload. When you click it, you're telling Uploadify's Flash uploader to stop uploading the associated file. Flash is throwing an error because it's being told to cancel a file upload that's already been completed.

If you don't want files to disappear from the queue once they've finished uploading (which is what happens when custom onComplete listeners return true), you must remove or replace the cancel button or its event listener.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号