You could just put the month/date as an appendage instead of a counter.  Or
just the Second of the time stamp.  

In all reality how many times would a filename be uploaded?

You might consider breaking down the container for holding the files into
sub folders.  This way the same camera file name won't be consistent in a
sub folder.

I never run into this issue because I organize the holding folder(s).  I use
GUIDs for the primary key of the table.  I then break the guid along breaks
of every dash -.  So    
d5348cfb-e077-45d2-9254-231076ead3b8  would look like this:
\d5348cfb\e077\  I will now have maybe 2 files in this folder, usually only
1.  

I made the GUID at receipt of file, I then declare if folder exists or not.
Make if needed and then use that path for the path section of my file table.
This way the USERS property never changes names according to them.  I have a
time date stamp in the table as well so the user would be shown the most
recent version of their file if that was important to them. 
 

.........................
Stephen Russell - 
Senior Visual Studio Developer, DBA

Memphis, TN
901.246-0159



-----Original Message-----
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of BigJ
Sent: Friday, November 21, 2008 10:19 PM
To: DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web
Services,.NET Remoting
Subject: [DotNetDevelopment] Image Upload


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

No virus found in this incoming message.
Checked by AVG - http://www.avg.com 
Version: 8.0.175 / Virus Database: 270.9.9/1802 - Release Date: 11/21/2008
9:37 AM


Reply via email to