1

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.

UMESH0492
  • 1,701
  • 18
  • 31

2 Answers2

2

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
Robins Gupta
  • 3,143
  • 3
  • 34
  • 57
1

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?

Yasser Shaikh
  • 46,934
  • 46
  • 204
  • 281