ng-file-upload icon indicating copy to clipboard operation
ng-file-upload copied to clipboard

App script code To delete uploaded file.

Open Nandinireddykondareddigari opened this issue 8 years ago • 2 comments

Hi If i'm not mistaken you want to make a DELETE request with the file path to the route where you saved the file. if you can setup a route for this DELETE request like that: router.delete('/uploads', (req, res, next) => { const path = req.body.path; // you can make use of the fs method unlink fs.unlink(path, (err) => { if (err) throw err; console.log('successfully deleted ', path); });) and in your app just prepare an ajax as described var filename = 'path/to/file'; // get this from where you saved the file earlier $.ajax({ url: "/uploads", data: { path: filename }, type: 'DELETE', success: function ( alert('file deleted'); }, error: function ( alert('file not deleted'); } });

oauthentik avatar Feb 17 '18 10:02 oauthentik

hi, I am needing the same. is it possible to do this, changing the method to DELETE and adding some parameters?

Upload.upload({ url: "https://xxxxxx.s3.amazonaws.com/", method: 'DELETE', ....

leonardoampuero avatar Jun 08 '18 21:06 leonardoampuero