Implementation Code of Jqueryajaxsubmit for uploading images _ jquery

Source: Internet
Author: User
This was a few months ago. The scenario was as follows: When uploading images, I found that the image uploading method used by developers was handled by Iframe + traditional httppost. In addition, no unified upload function is set up. The code is transformed. I want to use ajax to upload images asynchronously. This technology should be quite old. As a result, the powerful cnblogs can easily find this article, which is based on the gourd painting, and the author's Labor achievements can be taken directly ". Soon the code was fully transformed. But when I publish the program to the server, the problem arises. The uploaded file is invalid! Khan ~ It is the consequence of laziness. Continue to open the previous reference article. The author explained that it can only be used locally and cannot be published to the server. I thought, do I still have to use the iframe + http post depressing method ??

As a result, I opened a more powerful google and began to search for solutions globally. Finally, I was quite frustrated. Found "jquery. form. js? 1.1.20 ".

To upload an image asynchronously, follow these steps:

1. Reference The jquery js framework (there is no need to talk about the benefits of this stuff) and then reference "jquery. form. js ".
2. Set up the general processing program ashx.
The core code is as follows:
Html:

The Code is as follows:



Related Article

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.