Same file upload will upload again with a different name, instead of beeing cache like where only the name is returned
See original GitHub issuehi, i found same file upload will return different name,and this will create many files, i want upload same file. return the same file,please help me, i found this code
IncomingForm.prototype._uploadPath = function(filename) {
var buf = crypto.randomBytes(16);
var name = 'upload_' + buf.toString('hex');
if (this.keepExtensions) {
var ext = path.extname(filename);
ext = ext.replace(/(\.[a-z0-9]+).*/i, '$1');
name += ext;
}
return path.join(this.uploadDir, name);
};
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Files are appended together when uploading two different ...
If you upload same file again with same Upload-Key it will get append together. The state of previous upload is fetched from cache...
Read more >I've replaced an existing asset with a new file, but my site or ...
If the asset was already in use in your application or website, when accessing existing URLs for that asset, you may still see...
Read more >How to detect input type=file "change" for the same file?
This will reset all fields to default values, but in many cases you may be only using the input type='file' in a form...
Read more >Microsoft Office Upload Center
Microsoft Office Upload Center now gives you a way to see the state of files you're uploading to a server, in one location....
Read more >Invalidating files - Amazon CloudFront
Invalidate the file from edge caches. The next time a viewer requests the file, CloudFront returns to the origin to fetch the latest...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
https://github.com/node-formidable/formidable/pull/689 Try the branch, and use the changed filename option. Inside you can sync check existing filenames you have.
If you want to prevent duplicate file content but with different name then you have to manually compare file content after file upload and delete one.
Sorry, I will use Google Translate. I want to upload the same image only once, and if it exists, it will return the name of the previously generated image (similar to cache) instead of regenerating. I’m not sure if this kind of cache is better?