Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to upload multiple Files with asp.net

2025-03-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces asp.net how to achieve multi-file upload, the article is very detailed, has a certain reference value, interested friends must read it!

Simple implementation of file upload is very easy, but if you want higher requirements, such as uploading files through ajax, uploading more than one file at a time, large files, etc., the hole in it is not easy to fill (for beginners). So here I'm going to upload multiple files through ajax. Before you start posting code, there are a few points to pay attention to:

1. Must add name, do not know why not add the name attribute, the background can not get the file data (there is a way to remind me in the comments area), and then the multiple attribute, when the multiple= "multiple", the file control can select multiple files to upload ().

2.form to set enctype to multiple/form-data,multipart/form-data means: do not encode characters, you must use this value when using a form that contains file upload controls. For a detailed explanation of enctype, please see https://www.jb51.net/web/165444.html

3. The key point is that there is a big pit in the parameter settings of ajax (many people do not pay attention to many parameters of ajax). ContentType and processData need to be set to false,contentType is clearly required to be string type, but here it should be set to false (I don't know why). Most of the instructions on contentType on the Internet are "contentType: a parameter of type String. When sending information to the server, the content encoding type defaults to" application/x-www-form-urlencoded ". This default value is suitable for most applications. "there is also a data to be set to new FormData ($('') [0]). For other parameters, see this https://www.jb51.net/article/95425.htm."

Here is the simple foreground code:

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report