upload a file by using a traditional form form submission:
Test upload file via rest interface
Specify file name:
Upload file:
keyword 1:
keyword 2: Keyword 3:
However, the traditional form
XMLHttpRequest is a browser interface through which we can make Javascript communicate in HTTP (S). XMLHttpRequest is now a common way to interact with data in front and back of the browser. In February 2008, XMLHttpRequest Level 2 was proposed, and
Using FormData to upload files and images in JS,
About FormData
XMLHttpRequest Level 2 adds a new interface ---- FormData
The FormData object can be used to simulate a series of form controls using some key-value pairs in js. The send () method of
Write in front: This article says this program has the browser compatibility problem; Newer versions of all major browsers already support this object, such as Chrome 7+, Firefox 4+, IE 10+, Opera 12+, Safari 5+, and more sensitive sites for
About Formdata
XMLHttpRequest Level 2 Adds a new interface----FormData
Using the Formdata object, you can use some key-value pairs to simulate a series of form controls, you can use the XMLHttpRequest Send () method to asynchronously submit the
There are two ways to send a request, one is Ajax, the other is a form submission, and the default form submission, if not handled, will redirect the page. Explain with a simple demo:
The HTML looks like this, the requested path action is "upload"
From: http://blog.csdn.net/q1056843325/article/details/53759963
This article is my translation of the foreign language, not my originalOnline see a lot of blogs have reproduced this articleBut it's all in English.So I decided to translate
"Go" file a variety of upload, inseparable from the form"Go" file a variety of upload, inseparable from the formAs programmers, we often use the file upload and download function. When you need to use, a variety of search information. There are wood
IT wheel series (IV)-use Jquery + formdata object to upload files, jqueryformdataPreface
The following controls are generally used to upload files in MVC:
1 IT wheel 4 -- file Upload 2 3 4 View Code
Method 1: Use form upload
Front-end code:
use Ajax to submit form forms, including Ajax file uploadsHttp://www.cnblogs.com/zhuxiaojie/p/4783939.html
Preface
Using AJAX to request data, many people will, for example, say:
$.post (path,{data:data},function (data) {...
}, "json");
Or is
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.