将文件下载到指定的文件夹 [英] Downloading files to a specified folder

查看:301
本文介绍了将文件下载到指定的文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



在我的asp.net中可以选择下载一些数据作为txt文件,我想在客户端系统驱动器中创建一个文件夹单击下载按钮。就是当我点击下载按钮时,一个新的文件夹当前日期为foldername创建,而txt文件应该在其中下载。是否有可能。

Hi all

In my asp.net there is option to download some data as txt file ,I want to create a folder in client system d drive when we click the download button. that is when i click download button a new folder with current date as foldername creates and txt file should download inside it . is it possible.

推荐答案

不能在客户端机器中创建文件夹。但是使用ActiveX,你可以。在IE中也是如此..



参考链接:

在客户端计算机上创建文件夹 [ ^ ]



http://forums.asp.net/post/2733061.aspx [ ^ ]
You cannot create Folder in the Client Machine. but using ActiveX ,you can. that too in IE only..

Reference Links:
create folder on client machine[^]

http://forums.asp.net/post/2733061.aspx[^]


正确说明下载发生在客户端!因此,您拥有的唯一代码就是页面内有下载按钮的内容 - JavaScript ...

出于安全原因,JavaScript无法访问客户端的计算机而您无法设置目标文件夹下载 - 这是用户必须选择的东西......
As you properly states download occurs in client side! AS such the only code you have there is what inside your page with the download button - JavaScript...
For security reasons JavaScript can not access the clients' machine and you can not set the target folder for downloading - it's something the user have to choose...


这是不允许的,这是出于安全原因。如果任何 Web App 将操纵文件系统,那么它将对计算机构成风险,因为它可能会对计算机造成伤害。



所以,简单地说,不要这样做。用户应该优先选择文件夹,他/她可以保存文件。
This is not allowed and it is for security reasons. If any Web App will manipulate the File System, then it will be risk to computer as it can do harm to computer if possible.

So, simply, don't do this. User should get the preference of choosing the folder, where he/she can save the file.


这篇关于将文件下载到指定的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆