cancel
Showing results for 
Search instead for 
Did you mean: 

Rename the uploaded file

sunquanbin
Champ on-the-rise
Champ on-the-rise
HI,

I have create a file upload button (which reuses the share file upload) in a custom page. Everything works fine.

But how can I rename the file that has been uploaded?

For example, if the user upload a file "1.txt" it will be saved as the same name in the given folder.
Do I have option to rename it as "SomeText_1.txt" before saving it?

Regards,

Sun
2 REPLIES 2

lementree
Champ on-the-rise
Champ on-the-rise
Hi,

You can do it in onUploadCompleteData method of flash-upload.js file.

in this method you will get the uploaded file noderef, you can use that nodeRef and call custom repository webscript to update properties of Node.

niketapatel
Star Contributor
Star Contributor
Other option is - you can extend alfresco repository webscript which is being called on upload - /api/upload.

In this script, you can define your required name before creating file

var newFile = destNode.createFile(filename);