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.
Post Reply
cheemingyong
User
Posts: 37

Unique file names for uploads according to user session

Post by cheemingyong »

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 ?


Webmaster
User
Posts: 9425

Post by Webmaster »

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>"]


Post Reply