简体   繁体   English

如果未完全上传,则删除文件

[英]Multer remove file if not uploaded completly

I am using Multer for File upload with node JS. 我正在使用Multer通过节点JS上传文件。 But if i abbort the upload there is still a file left with a random name and without extension. 但是,如果我中止上传,则仍然会留下一个带有随机名称且没有扩展名的文件。 My question is how to delete the file if it wasnt uploaded completly? 我的问题是,如果文件没有完全上传,该如何删除?

You should not upload file before submitting form. 提交表单之前,您不应上传文件。 So you should add upload trigger button to forms submitting button. 因此,您应该将上传触发按钮添加到表单提交按钮。 In this case file will not be uploaded at all. 在这种情况下,将根本不会上传文件。 If you provide more information maybe I can suggest something more precise. 如果您提供更多信息,也许我可以建议更精确的方法。

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

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