使用Asp.net将文件夹上传到服务器

问题描述:

你好,



我知道FileUpload Control允许你一次上传一个文件和输入(文件)html控件,它允许你上传文件夹中选择的多个文件。我的问题是:是否可以选择一个文件夹(包含每个子文件夹中包含文件的子文件夹)并直接上传整个文件夹?如果没有,是否可以将其中一个文件的位置放在一个子文件夹中并上传剩余的文件? (子文件夹中的树结构保持不变)。我正在尝试做第二个选项,但到目前为止还无法达到可能的解决方案。

Hello,

I am aware of the FileUpload Control that allows you to upload one file at a time and the input(File) html control that allows you to upload multiple files selected in a folder. My question is: Is it possible to select a folder (that has subfolders with files in each subfolder) and upload the whole folder directly? If not, is it possible to get the location of one of the files in one subfolder and uploading the remaining as well? (the tree structure in the subfolders remains the same). I am trying to do the second option, but am not able to reach to a possible solution as of yet.

不,你不能这样做,一个可能的解决方案是将您的文件夹压缩为zip并将其上传到服务器,然后从服务器上提取zip文件。
No, you can't do that, one possible solution is to compress your folder as zip and upload it to server then from server you can extract zip file.