Uploadify upload Problem

Source: Internet
Author: User

Version: Uploadify version 3.2
Official website: http://www.uploadify.com

Uploadify is a jquery-based upload plugin that is easy to use. However, the upload process of the prompt language in English, here to organize how to modify the English as Chinese tips.
Method 1: Modify the prompt information in the uploadify.js directly, and change the English hint to the corresponding Chinese. However, from the software design point of view, directly modifying the original class library is not the best solution, will affect the software upgrade.

Method 2: Override the Uploadify event
' Overrideevents ': [' ondialogclose ', ' onuploaderror ', ' onselecterror ']
When you override the Ondialogclose event, the uploadify error message is not prompted. Prompt information can be directly customized popup.

The definition of overriding event ErrorCode can be found in the JS library. You can also use the THIS.QUEUEDATA.ERRORMSG to change the cue message directly.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 666768697071727374757677787980818283848586878889909192939495 var uploadify_onSelectError = function(file, errorCode, errorMsg) {        var msgText = "上传失败\n";        switch (errorCode) {            case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:                //this.queueData.errorMsg = "每次最多上传 " + this.settings.queueSizeLimit + "个文件";                msgText += "每次最多上传 " + this.settings.queueSizeLimit + "个文件";                break;            case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:                msgText += "文件大小超过限制( " + this.settings.fileSizeLimit + " )";                break;            case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:                msgText += "文件大小为0";                break;            case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:                msgText += "文件格式不正确,仅限 " + this.settings.fileTypeExts;                break;            default:                msgText += "错误代码:" + errorCode + "\n" + errorMsg;        }        alert(msgText);    };var uploadify_onUploadError = function(file, errorCode, errorMsg, errorString) {        // 手工取消不弹出提示        if (errorCode == SWFUpload.UPLOAD_ERROR.FILE_CANCELLED                || errorCode == SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED) {            return;        }        var msgText = "上传失败\n";        switch (errorCode) {            case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:                msgText += "HTTP 错误\n" + errorMsg;                break;            case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:                msgText += "上传文件丢失,请重新上传";                break;            case SWFUpload.UPLOAD_ERROR.IO_ERROR:                msgText += "IO错误";                break;            case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:                msgText += "安全性错误\n" + errorMsg;                break;            case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:                msgText += "每次最多上传 " + this.settings.uploadLimit + "个";                break;            case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:                msgText += errorMsg;                break;            case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:                msgText += "找不到指定文件,请重新操作";                break;            case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:                msgText += "参数错误";                break;            default:                msgText += "文件:" + file.name + "\n错误码:" + errorCode + "\n"                        + errorMsg + "\n" + errorString;        }        alert(msgText);    }    return parameters;}var uploadify_onSelect = function(){};var uploadify_onUploadSuccess = function(file, data, response) {    alert(file.name + "\n\n" + response + "\n\n" + data);};var uploadify_config = {    ‘uploader‘ : ‘upload.php‘,    ‘swf‘ : ‘/js/uploadify/uploadify.swf‘,    ‘buttonImage‘ : ‘/images/uploadify-button.png‘,    ‘cancelImg‘ : ‘/images/uploadify-cancel.png‘,    ‘wmode‘ : ‘transparent‘,    ‘removeTimeout‘ : 0,    ‘width‘ : 80,    ‘height‘ : 30,    ‘multi‘ : false,    ‘auto‘ : true,    ‘buttonText‘ : ‘上传‘,    ‘hideButton‘ : ‘true‘,    ‘fileTypeExts‘ : ‘*.png;*.jpg;*.jpeg‘,    ‘fileSizeLimit‘ : ‘1MB‘,    ‘fileTypeDesc‘ : ‘Image Files‘,    ‘formData‘ : {"action": "upload", "sid" : ""},    ‘overrideEvents‘ : [ ‘onDialogClose‘, ‘onUploadSuccess‘, ‘onUploadError‘, ‘onSelectError‘ ],    ‘onSelect‘ : uploadify_onSelect,    ‘onSelectError‘ : uploadify_onSelectError,    ‘onUploadError‘ : uploadify_onUploadError,    ‘onUploadSuccess‘ : uploadify_onUploadSuccess};$("#id").uploadify(uploadify_config);

Note: Since the flash bug caused the upload in FF to not get to the session, you can use Formdata to pass the value, such as:

1 formData : { ‘<?php echo session_name();?>‘: ‘<?php echo session_id();?>‘}

Website Description Address: http://www.uploadify.com/documentation/uploadify/using-sessions-with-uploadif

Uploadify upload Problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.