I'm using the FileUpload control to upload images to my image folder,
storing the pathway to the image in table. My primary key is the
imagePath column My question is, how do you detect if an image
already exists in the table, and if so how to alter the name like
image/mypic.jpg and image/mpic(2).jpg , so on and so forth.
I came up with the initial idea of adding an imageCnt column
(equivalent of a counter) using the SqlDataSource control to get the
latest version of the image like so:
SelectCommand="SELECT MAX(ImageCnt) FROM userImages WHERE
ImagePath LIKE @ImagePath"
I was going to then the result of that to decide what number to append
to the image. However the problem is how do I grab that ImageCnt
value before the insert action is attempted? Any insight is
appreciated...thanks.
Thanks
Jon