I am stuck how to rename the uploaded file to server. don't know how to rename the file and send that url further.
Using [loopback-storage-service]
Do i make changes in container model? Help is appreciated.
I am stuck how to rename the uploaded file to server. don't know how to rename the file and send that url further.
Using [loopback-storage-service]
Do i make changes in container model? Help is appreciated.
To rename create a file inside your loopback boot
folder
boot/renameFile.js
module.exports = function(app) {
//Function for checking the file type..
app.dataSources.presImage.connector.getFilename = function(file, req, res) {
//Return the new FileName
return 'NEW_FILENAME.JPG'
}
}//exports
I checked the angular-file-upload's github page, it says
Angular File Upload is a module for the AngularJS framework. Supports drag-n-drop upload, upload progress, validation filters and a file upload queue. It supports native HTML5 uploads, but degrades to a legacy iframe upload method for older browsers. Works with any server side platform which supports standard HTML form uploads.
I also checked angular-file-upload.js, there is no provision for renaming in it.
I would recommend to upload the file first and then using your server side code rename it for you, it will be easier that way.
Update : Found this on its github issues - Is it possible to rename the file before upload?