Form form upload file, upload success get return data

Source: Internet
Author: User

Project development process, involving the image upload and file upload. In the "Picture upload" and "File Upload" feature, I used the form form in the project, a simple example is as follows:

One, picture or file upload

The HTML code is as follows:


The rendering effect on the page is as follows:


Select the file, click Submit, and execute the following results:



The first diagram of the results shown above shows that the action in form forms has been executed, and that the second diagram of the results above shows that the selected file and related information have been uploaded. Upload completed, the rest of the matter to the background processing.

second, after the upload is completed, get the return information.

After the image or file upload, we need to return information in the background to determine whether the upload is successful, get the method of return information, through the following simple example:

JS Code:


The results of the implementation are as follows:


As you can see from the execution result graph, the "Internal server error" information is fetched and printed.

In addition, usually in the project, the IFRAME is hidden, and here it appears to be more intuitive.


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.