Developer forum

Forum » CMS - Standard features » Alter/change filename on upload through forms for editors

Alter/change filename on upload through forms for editors

Hans Ravnsfjall
Hans Ravnsfjall
Reply

Hi

 

Is there someway to alter/change the filename when uploading through Forms for editors?

We would like to add eg. a DateTime.Now to the filename. THe new filename ofcourse will have to be a the link that will be shown in the email sent when the form is filled.

Is this possible somehow?

/Hans

Replies

 
Lars Larsen
Lars Larsen
Reply

Hi Hans

Why do you want to add a DateTime.Now to the filename of an uploaded file? All uploaded files will have a creation datetimestamp. If you want this information in a confirmation email you can get this information in a Razor template using System.IO.GetCreationTime(). 

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

The reason for adding timestamp to the photos is, that the files are being transferred to a local drive daily, and deleted from the dynamicweb folder. If two files have the same filename eg. image1.jpg, then the file on the local folder will be overwritten, which will cause havoc. If we rename the file on the local folder on the fly, then the problem will be with the email sent along with the form submittance, as the local link in the mail will be broken - since the filename is changed after being uploaded.

Therefore I was thinking of adding a timestamp to the filename, to ensure a unique filename. Another posibility would be to replace the filename totally with a 32 digit random string or something like that.

therefore I need to change the filename on upload.

Any ideas how this can be achieved?

/hans

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Anyone who can tell me if this would be possible to achieve?

 

/Hans

 
Kristian Kirkholt
Kristian Kirkholt
Reply

Hi Hans

It is not an option by standard DW to change the filename and adding timestamp during uploade. But perhaps this could be achieved by advanced template/Scripting.

Kind Regards
Dynamicweb Support
Kristian Kirkholt

 

You must be logged in to post in the forum