Anyone know if there's a good way to prevent the entry from being rewritten to the Attach database if the file already exists?
For example.
Say I have an image called myimage.jpg, and I upload, but realize that the image needs to be modified and reuploaded. When I reupload the image, it replaces the old image, but it rights a new entry to the database, so then I have two entries with the same filename, but only one image in the directory and if I try to get rid of the second entry, it removes the image.
There's no check in sub attach_file to see if the image is already there:
$query = qq~
INSERT INTO $table (ID, DataID, ServerName, FileName, FileType, FileSize)
VALUES (?, $data_id, "$data_id.fil", $fn, $ft, $size)
~;
This one is beyond me.
Thanks for any help.
Peace.
Kyle
For example.
Say I have an image called myimage.jpg, and I upload, but realize that the image needs to be modified and reuploaded. When I reupload the image, it replaces the old image, but it rights a new entry to the database, so then I have two entries with the same filename, but only one image in the directory and if I try to get rid of the second entry, it removes the image.
There's no check in sub attach_file to see if the image is already there:
$query = qq~
INSERT INTO $table (ID, DataID, ServerName, FileName, FileType, FileSize)
VALUES (?, $data_id, "$data_id.fil", $fn, $ft, $size)
~;
This one is beyond me.
Thanks for any help.
Peace.
Kyle