| |

VerySource

 Forgot password?
 Register
Search
View: 1029|Reply: 8

Questions about uploading and downloading files in ASP.Net

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 Italy

Post time: 2020-2-1 09:00:01
| Show all posts |Read mode
My client said uploading and downloading files on the server was too much trouble and asked for simplification, he wanted to

Upload:
    To achieve the file selection window like FileUpload click "Browse", but you can hold down the Ctrl key to select multiple attachments to upload, I do not know if there is a way to achieve this, similar operations are also possible, or third-party controls are also acceptable

download:
    I put all the attachments in a GridView, there is only a list of file names, and the DataNavigateUrlFields property is set to the path of the attachment. When running the program, I click on any row of the GridView to connect to this file and prompt to download. The user wants to add below A "Download All Attachments" Button, when clicked, a directory tree appears. He selects the folder and clicks OK. All attachments in the GridView are downloaded to this folder.

Masters have helped a lot
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-3-16 17:45:01
| Show all posts
1:

Can allow uploading a compressed file and decompress it on the server side
Otherwise, you can only make an ActiveX control.

2: You describe something wrong
   Download everything in the selected folder locally or download the file to the selected folder

The latter is difficult to implement with other controls
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-3-17 00:45:02
| Show all posts
This control is not bad. You can go and see

http://www.ntko.com
   Once NTKO Accessory Management Control 3.0 was launched, it won praise from the majority of development partners for its innovative architecture and flexible and powerful programming interface. And already has dozens of successful cases including Domino, ASP, ASP.NET and other platforms. Here I would like to express my sincere thanks to the partners who have given us valuable suggestions and opinions!
   Using NTKO attachment management control [multi-file upload control], you can launch the application corresponding to the original file in the browser, edit, print, read, and save any file such as image files, OFFICE files, AUTOCAD files, text files, Web server. Supports drag and drop, modification prompt saving, multi-threaded download and upload, multiple view modes, smart submission and other features. Supports various back-end web servers and programming languages ​​including DOMINO.
Reply

Use magic Report

0

Threads

29

Posts

16.00

Credits

Newbie

Rank: 1

Credits
16.00

 China

Post time: 2020-3-17 02:00:01
| Show all posts
Can be uploaded in a loop
Reply

Use magic Report

0

Threads

29

Posts

16.00

Credits

Newbie

Rank: 1

Credits
16.00

 China

Post time: 2020-3-17 13:45:01
| Show all posts
<HTML>
<HEAD>
<script>
function AddAttachments ()
{document.getElementById ('attach'). innerText = "Continue adding attachments";
tb = document.getElementById ('attAchments'); newRow = tb.insertRow ();
newRow.insertCell (). innerHTML = "<input name = 'File' size = '50 'type =' file '>&nbsp;&nbsp;
<input type = button value = 'Delete' onclick = 'delFile (this.parentElement.parentElement.rowIndex)'> ";
}
function delFile (index)
{document.getElementById ('attAchments'). deleteRow (index); tb.rows.length> 0? document.getElementById ('attach'). innerText = "Continue adding attachments": document.getElementById ('attach'). innerText = "Add attachment";} </ script>
</ HEAD>
<body MS_POSITIONING = "GridLayout">
<form id = "form1" method = "post" runat = "server" enctype = "multipart / form-data">
<div> <table id = "attAchments">
</ table> </ div>
<span>
<IMG src = "icoAddFl.gif"> </ span>
<A id = "attach" style = "font-family: 宋体; font-size: 9pt;" title = "If you want to send multiple attachments, you only need to click" Continue to add attachments "multiple times. Pay attention to The total number of attachments cannot exceed the sending limit. "Onclick =" AddAttachments (); "href =" javascript :; "name =" attach "> Add Attachments </A>
<br> <br> <br> <br> <br> <br>
<asp: Button id = "btnSend" runat = "server" Text = "upload"> </ asp: Button> </ form>
</ body>
</ HTML>
Reply

Use magic Report

0

Threads

29

Posts

16.00

Credits

Newbie

Rank: 1

Credits
16.00

 China

Post time: 2020-3-17 16:45:01
| Show all posts
private void btnSend_Click (object sender, System.EventArgs e)
{
StringBuilder sb = new StringBuilder ();
int attCount = 0;
string filePath = "";
for (int i = 0; i <Request.Files.Count; i ++)
{
if (Request.Files [i] .ContentLength> 0)
{
filePath = Request.Files [i] .FileName;
 sb.Append ("Files" + attCount ++ + ":" + filePath + "<br>"); Request.Files [0] .SaveAs (Server.MapPath ("./") + filePath.Substring (filePath.LastIndexOf ( "file: //") + 1 /));
}
}
sb.Insert (0, "you upload" + attCount + "files. <br>");
Response.Write (sb.ToString ());
}
Reply

Use magic Report

0

Threads

31

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

Post time: 2020-3-18 08:30:01
| Show all posts
The landlord said that this has not been done, but has done something similar to EMAIL uploading multiple attachments at one time, that is, calling fileupload multiple times, downloading should also be possible, you may cycle the file he selected, and use webhttprequest to request the assembled download address, Take response.getstream () to see if the file you want in the stream is written on the hard disk.
I have n’t done this before, you try it, I feel OK
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-6 09:45:01
| Show all posts
The host uses Uploadify to meet all your needs. If you have any questions, you can ask me. I have been studying this for a while. The most imperfect aspect of this plugin is that it cannot upload image previews. This is due to the flash mechanism. Now the flash palyer version 10+ and above can achieve previews. I have been uploading this piece for a long time--I have to develop an upload The pure flash upload of pictures is formed--
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-6 10:00:01
| Show all posts
We all use the swfupload plug-in to implement file uploads, which can realize the upload file size setting, upload file limit and so on. . . .
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list