如何在客户端保存文件? [英] How to save file in Client Side ?

查看:126
本文介绍了如何在客户端保存文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在javascript中实现此"fileupload.SaveAs(Server.MapPath(path))"

how to acheive this "fileupload.SaveAs(Server.MapPath(path))" in javascript

How to save file in  Client Side


?

推荐答案

您不能.
文件上载必须在服务器中以服务器代码的形式进行处理-Javascript代码在客户端中运行,并且出于安全原因无法访问服务器硬盘驱动器.
You can''t.
File Uploads have to be processed at the Server in in Server code - Javascript code runs in the Client and cannot access the server hard drives foe security reasons.


您不能直接保存客户计算机中的文件.由于安全限制,浏览器不允许您使用.

但是可以,您可以编写代码以在浏览器上显示下载"对话框.然后,用户将决定是否将其保存在他/她选择的目录中.
You can''t directly save the files in client''s computer. Browsers won''t allow you due to security restrictions.

But yes, you can write codes to show a Download Dialog Box on Browser. Then user would decide whether to Save it or not on his/her selected directory.


这篇关于如何在客户端保存文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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