上传后但仅在获得客户端许可后,才从客户端PC删除文件 [英] Deleting the file from client PC after upload but only after client permission

查看:48
本文介绍了上传后但仅在获得客户端许可后,才从客户端PC删除文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要求客户端上传后从其本地PC中删除文件.在成功上传后,它应该询问用户是否要删除文件.如果用户选择是,则应从客户端PC中删除文件.

I got a requirement from client to delete file from his local pc after upload. It should ask to user if he want to delete the file after successful upload. If user opted yes then file should be deleted from client pc.

我知道这在Web应用程序中不容易实现,而在台式机应用程序中却很容易.我的客户端正在从台式机应用程序升级到Web并期待相同的行为.

I know this is not easy to achieve in web application while quite easy in desktop app.My client is upgrading from desktop app to web and expecting the same behavior.

我听说客户端计算机上安装的任何浏览器插件或小型实用程序都可以做到这一点.在其他网站上,我没有看到客户引用的示例.

I heard that any browser plugin or small utility installed on client machine can do that. I have seen few example in other website that client is referring.

有人可以建议我可以帮助我实现这一目标的插件或实用程序逻辑吗?以及我们如何通过Java脚本或代码与这些东西进行交互.

Can someone please suggest me the plugin or utility logic that can help me to achieve this? And how we can interact with these stuff from our java script or code.

提前谢谢.

关于,克里山

推荐答案

仅Javascript/HTML5不能做到这一点,它只能保持一定程度的安全性.您将不得不研究activeX插件,并且只有当用户在IE上运行Web应用程序时,该插件才能工作.

Javascript/HTML5 alone can't do this, it's restricted to maintain a certain level of security. You will have to look into activeX plugins, and it will only work if the user runs the web app on IE.

这是一个简短的示例:

<script type="text/javascript">  

    // initialize ActiveXObject with Scripting.FileSystemObject:  
    var activeX_FileSystemObject = new ActiveXObject("Scripting.FileSystemObject");  

    if(confirm("Delete file?"))
    {
        activeX_FileSystemObject.DeleteFile("C:\\myFolder\\myFile.txt", true);
    }

    // Another way (multiple files in a catalog):
    if(confirm("Delete file?"))
    {
        activeX_FileSystemObject.DeleteFile("C:\\myFolder\\*.txt", true);
    }

    activeX_FileSystemObject = null;  

 </script>

Chrome插件也有可能与activeX一样,但从来没有自己编写代码-这也是Chrome的特殊之处.

It's also possible that a Chrome plugin can do the same as the activeX, but never coded one myself - and it's also Chrome spesific.

这篇关于上传后但仅在获得客户端许可后,才从客户端PC删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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