ngx-uploader
ngx-uploader copied to clipboard
How to change file name
"ngx-uploader": "^4.0.2",
how do you mean how to change file name?
User selects image with name IMAGE_26375.png
But before uploading to server i want to change name to ca_21_profile.png
I tried, but this did't change file name
onUploadOutput(output: UploadOutput): void {
if (output.type === 'addedToQueue' && typeof output.file !== 'undefined') {
output.file.name = 'osritMy.png';
this.files.push(output.file);
}
}
@mdhanju lets discuss a possible solution for that.
The only way I see is a filename template like 'ca_21_profile' as base name with a prefixed or suffixed hash to get identifiable files (eg: 1738456879_ca_21_profile.png, ca_21_profile_1738456879.png). A counter does'nt make sense, cause the files will be overwritten by the server (without a file handler on the server side). This can be implemented in NgUploaderService and we are needing an UploaderOption for that.
I don't really get if the feature has been implemented in the release 4.x, because we're now in 6.x? If so, may I ask for a sample code, because @mdhanju is still not working?
changing the filename would indeed be useful, for example if the user uploads 4 files named 1.jpg and we rename them before uploading in order to prevent clashes
Hi, using ngx-uploader 7.1.0 - any updates on this feature? We also have a need to prevent users from uploading the same filename multiple times.