简体   繁体   English

在提交表单之前使用Jquery上传文件-Asp.net MVC

[英]Uploading Files with Jquery before Form Submit - Asp.net MVC

We Typically attach a files with a HTML File input and submit the form to the server with Content-Type=multipart/form-data. 通常,我们使用HTML File输入附加文件,然后使用Content-Type = multipart / form-data将表单提交到服务器。

However in modern way now the files start to upload via jquery ajax as soon as we select and after this the form is posted. 但是,现在以现代方式,一旦我们选择并在表单发布后,文件就开始通过jquery ajax上传。

So what is best approach to achieve the above action at client side as well as getting the posted file at server when form is submitted to the controller action? 那么,什么是在客户端上执行上述操作以及在将表单提交给控制器操作时在服务器上获取发布文件的最佳方法呢?

Regards 问候

I am not sure why you want before submit button click getting the posted file at server. 我不确定为什么要在提交按钮单击之前在服务器上获取发布的文件。

You can refer this 你可以参考这个

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM