Reputation: 67
Hello i am making mean application in which i have to upload picture.I want when uploading these picture before going to server I want rename this picture so that when it goes to server than the filename is new file name.
For example i upload img1.png
so my controller change the name image toasd232.png
and new file name should go to server.
Upvotes: 2
Views: 8589
Reputation: 45106
Provided that you have access to FormData
being sent to server you could change file name when appending a file using the third parameter of append
method. Docs
formData.append('userpic', myFileInput.files[0], 'chris.jpg');
Upvotes: 13