当用户取消上传表单时如何删除文件?
我有一个页面允许用户使用 http://www.uploadify.com/ 上传一些视频和文档,有什么方法可以做到这一点:当用户退出上传表单(刷新、关闭选项卡、浏览器或单击另一个网址)时,它会自动删除用户刚刚上传的文件。请帮我。
I have a page allows users to upload some video and document use http://www.uploadify.com/, is there any way to do that: when users quit upload form (refresh, close tab, browser, or click another url), its automatic delete the file that user have just uploaded. Please help me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可以手动完成。文件上传到服务器后,您就会知道文件名。现在,您可以在触发所需的
Event
时对其进行 ajax 调用,这将使用 php 的unlink()
函数删除该文件。It could be done manually. Once the file is uploaded on the server, you will know the file name. Now you could make an ajax call on the required
Event
when it is fired, which will delete the file using php'sunlink()
function.您可以限制上传文件的总大小。通过将其粘贴到
jquery.uploadify.v2.1.4.min.js
中并在取消按钮上删除它,单击取消按钮上调用此方法并删除目录中上传的文件。
Session["DestinationPath"]
包含保存上传文档的文件夹路径。You can restrict the total size of uploaded file. By pasting this in
jquery.uploadify.v2.1.4.min.js
and delete it on the cancel button clickThis method is called on cancel button and delete the file uploaded in directory.
Session["DestinationPath"]
contains path of folder to save the documents uploaded.