views:

277

answers:

1

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

    }
A: 

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.

jdbartlett