I would like to request a possibility to replace current asset with new version of asset (all links to the asset should be kept as they are).
Currently when we upload an asset with the same name as one in given folder, then completely new asset is created.
I propose that if the same name is detected then user should be asked to choose whether he/she want to create a new asset or simply exchange the current one.
Comments
Comment #1
oskarb commentedMaybe easier would be to add an option in module configuration whether to replace current file or create new asset when file with the same name is uploaded
Comment #2
zambrey commentedIt would be great to have this feature in Asset module.
I have actually tried to do this because I need this functionality on one of my sites.
So I have tried some obvious method by setting upload method (in file_save_upload() function) to FILE_EXISTS_REPLACE but I ended up having 2 assets pointing to the same file. It isn't that easy as I thought.
However, using file_save_upload() creates record in {files} table for each asset and this record is still there even if asset is deleted.
So it actually creates unnecessary data because we don't have any information about 'file record' in {asset} table.
So in order to prevent this we could delete new {files} record after asset is created.
But actually if we had some information about 'file' in asset table then we could easilly use this replace method I tried with FILE_EXISTS_REPLACE flag. It can be used by checking if file_save_upload() creates new record or not.
So I hope that my little research will put some light on this issue :)
Thanks
Comment #3
HansBKK commented+1
Comment #4
wmostrey commented