简体   繁体   English

上传后重命名或删除客户端计算机上的文件

[英]Rename or Delete a File on Client's Machine after Upload

Hello I have a couple of questions. 您好,我有几个问题。

-Is there a way to be able to either delete or rename a file on the client’s machine after he uploads the file via a file upload control to the server. -在客户端通过文件上传控件将文件上传到服务器后,是否可以删除或重命名该客户端计算机上的文件。

-This one is closer to a question that I asked before ( link ), would you be able to get the path of a uploaded file or move the uploaded file on a client’s computer if the client has IE Trusted Sites Security Zone for your website. -这个问题更接近我之前问过的一个问题( 链接 ),如果客户端具有您网站的IE可信站点安全区域,那么您将能够获取上载文件的路径或将上载的文件移动到客户端计算机上。

The overall problem is that Clients are uploading many files to a website. 总体问题是客户正在将许多文件上传到网站。 Once the file is uploaded it needs to be clear on the client's computer that the file already has been uploaded once so that they do not miss or re-upload the same file. 文件上载后,需要在客户端计算机上清除该文件已经上载一次,以免丢失或重新上传相同的文件。 If the file has been renamed, moved, or deleted upon upload then it would be difficult for them to miss or re-upload a file. 如果文件在上载时已被重命名,移动或删除,那么他们将很难错过或重新上传文件。

No, you cannot delete files from the client's machine ( not without some type of extension or parallel software running on the machine ). 不可以,您不能从客户端计算机上删除文件( 并非没有在计算机上运行某种类型的扩展名或并行软件 )。 I would instead encourage you to consider another route. 相反,我鼓励您考虑另一条路线。 When multiple files are selected for upload, you have access to their file names and file sizes via JavaScript: 选择多个文件进行上传时,您可以通过JavaScript访问它们的文件名和文件大小

fileupload.addEventListener( "change", function () {
    console.log( this.files ); // FileList {0: File, 1: File, 2: File, length: 3}
});

I would suggest you send this list of details over to a server-side script that inspects them against a history of uploads from the current user. 我建议您将此详细信息列表发送到服务器端脚本,该脚本将根据当前用户的上传历史对其进行检查。 If matches exist, you can relay that information back to the user and allow them to modify their list of files to upload. 如果存在匹配项,则可以将该信息转发给用户,并允许他们修改要上传的文件列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM