Last post May 18, 2006 02:17 PM by pooh2006
May 12, 2006 03:45 PM|pooh2006|LINK
i have a chatting website, and i created aspx page with upload control for users to upload their personal images, after limiting size, validate type jpg,bmp and recieving file content and using bitmap and graphics classes i create new resized one with watermark,
the problem when saving file as jpeg type i want to overwrite old image if found, after that updating phys path into database for this user, then i want to ask a questions:-
is it safe to overwrite image or it's better to save it with auto generated filename and update database with it,and store old name so i can after period of time delete it.
May 14, 2006 01:56 PM|DMW|LINK
May 14, 2006 04:30 PM|pooh2006|LINK
May 15, 2006 11:34 AM|Dieu|LINK
Save the first uploaded image as "myavatar.jpgg", load it, resize it, save it as "myavatar.jpg", dispose loaded image, delete "myavatar.jpgg". That's the way I'm using. There should be no problem and no need to extra delete process.
Save each image with users nick name or just the ID from database. After the resize process you can delete ancient file and save the new one resized from "myavatar.jpgg".
May 15, 2006 09:08 PM|pooh2006|LINK
May 16, 2006 03:51 AM|Dieu|LINK
May 16, 2006 09:35 AM|pooh2006|LINK
May 16, 2006 07:36 PM|Fredrik K|LINK
The solution could be to save the new file with a new name, insert that name in DB so new user requests pull the new image file, then you delete the ancient file. All those can be done in a row after the users new avatar upload. And for file names maybe u can
use a System.Guid.NewGuid.ToString.
May 17, 2006 03:14 AM|Dieu|LINK
May 17, 2006 06:17 AM|Fredrik K|LINK
May 18, 2006 02:17 PM|pooh2006|LINK