How does javascript-webuploader verify the information returned by the upload?

Source: Internet
Author: User
The js in the Image Upload demo provided by webuploader does not provide the callback information to verify whether the upload is successful, and many codes in that js are not verified. I can now upload the file successfully and save it to the database. when the upload fails, the upload page cannot be verified... the js in the Image Upload demo provided by webuploader does not provide callback information to verify whether the upload is successful.
And a lot of code in that js is not verified.
I can now upload successfully and save it to the database, but when the upload fails, the upload page cannot verify that the upload is successful.
I verified it like this.

  uploader.on('uploadSuccess', function (file,response) {        if(response.status==1){            $('#' + file.id).addClass('upload-state-done');            alert('response.url')        }            });

I am using the example in the image-upload folder in examples. There is a button to Click upload AND THE updateStatus under the folder to be thumbnail cannot be detected.

Is there a simple example to send

Reply content:

The js in the Image Upload demo provided by webuploader does not provide callback information to verify whether the upload is successful.
And a lot of code in that js is not verified.
I can now upload successfully and save it to the database, but when the upload fails, the upload page cannot verify that the upload is successful.
I verified it like this.

  uploader.on('uploadSuccess', function (file,response) {        if(response.status==1){            $('#' + file.id).addClass('upload-state-done');            alert('response.url')        }            });

I am using the example in the image-upload folder in examples. There is a button to Click upload AND THE updateStatus under the folder to be thumbnail cannot be detected.

Is there a simple example to send

You have not carefully read the document... Actually, there is a response parameter in addition to the file in the successful callback, which is used to receive the data returned by the server. You only need to return json and it will receive it. You can read the document carefully.

// The file is uploaded successfully. The class is added to the item and the style indicates that the upload is successful.

Uploader. on ('uploadsuccess', function (file, response) {var imgurl = response. url; // upload image path $ ('# images '). val (imgurl); $ ('#' + file. id ). addClass ('upload-state-success '). find (". state "). text ("uploaded") ;}); response. the url in the url returns my upload address. if it cannot determine whether the upload is successful, you will return a status in the background. if (status = 1) the upload is successful.

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.