Unique file names for uploads according to user session

This public forum is for user-to-user discussions of ASP.NET Maker. Note that this is not support forum.

Unique file names for uploads according to user session

Postby cheemingyong » Thu Sep 14, 2017 11:36 am

everytime i do a file upload lets say the name of the file upload is img_xxxx.jpg

but another user who is logged in may also upload img_xxxx.jpg and overwrite my
upload because we are sharing the same upload folder.

how do i prevent this problem ? can i like assign a filename which i can tag
the session id to the name of the file that is uploaded by modifying ewupload.cs ?
and this new filename will be saved in the database instead ?
cheemingyong
 
Posts: 44
Joined: Wed May 17, 2017 12:00 pm

Re: Unique file names for uploads according to user session

Postby Webmaster » Fri Sep 15, 2017 9:31 am

You can use the Row_Inserting / Row_Updating server events to change the upload file name. The upload file name can be accessed in the server events via rsnew["<FieldName>"]
Webmaster
 
Posts: 10733
Joined: Fri Aug 06, 2004 5:59 pm


Return to General Discussion (ASP.NET Maker)