Home > Web Front-end > HTML Tutorial > Pseudo Ajax for file upload_html/css_WEB-ITnose

Pseudo Ajax for file upload_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:47:56
Original
1161 people have browsed it

Iframe upload files

Continued from the previous article: The biggest feature of Ajax is no refresh, so the author wants to upload files by simulating Ajax, that is, iframe upload files

Without further ado, let’s get straight to the code

HTML:

1 <iframe name="send" style="display:none"></iframe>2 3 <form action="/home/receiveAjax/" target="send" method="post" enctype="multipart/form-data">4         <input type="text"/>5         <input type="file" name="file" id="file" />6         <input type="submit"/>7 </form>
Copy after login

C#:

1         [HttpPost]2         public ActionResult receiveAjax(string s1)3         {4             HttpPostedFileBase file = Request.Files[0];5             return Content("Success");6         }
Copy after login

The background code is the same as the previous article. If is displayed, you can also see the background code The return value "Success", and if there is an error, you can also debug it through the error in the returned iframe

The biggest feature of this upload method is that there is not a single line of javascript code

At this point, this article The end of this article, if you have any questions, please feel free to correct me

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template