I'm using the ng-file-upload to upload images in a web app.
Upload process works good, but when I try to give each file a unique name using momentJS, it won't automatically keep the format and save it without file extension.
For example, image.jpg will become 12-07-2016-23-36-44.
I managed to fix this using the following code, but then it will save all images to JPG even if they are not (PNG, GIF...)
$scope.uniquelogo = moment().format('DD-MM-YYYY-HH-mm-ss') + '.jpg';
Upload.upload({
url: 'upload.php',
data: {
file: file,
name: Upload.rename(file, $scope.uniquelogo)
}
How could I use Upload.rename() and still keep the original file format?
.jpg?