Hi
I am using Persits' ASPUpload component. While it works fine, I am wondering what to do if two or more files being uploaded share the same file name.
When I saw their documentation, it reads something like this...
Forcing Unique File Names
By default, AspUpload will overwrite existing files in the upload directory. If this is undesirable, the component can be configured to generate unique names for the files being uploaded to prevent overwriting existing files in the upload directory. This is done by setting UploadManager's OverwriteFiles property to False before calling Save:
Upload.OverwriteFiles = False
This property is True by default.
To prevent name collisions, AspUpload will append the original file name with an integer number in parentheses. For example, if the file MyFile.txt already exists in the upload directory, and another file with the same name is being uploaded, AspUpload will save the new file under the name MyFile(1).txt. If we upload more copies of MyFile.txt, they will be saved under the names MyFile(2).txt, MyFile(3).txt, etc.
But when I store the fileNames in the database, I am storing something like "C:\Upload\MyFile.Jpg".
This thanks to the component's Path property.
But when saving, if the component changes the filename, i.e, adds a number in paranthesis, how'd I update the database to reflect the value ? I hope you got my doubt..
Can you help me out of this??
Thank you...
RR
I am using Persits' ASPUpload component. While it works fine, I am wondering what to do if two or more files being uploaded share the same file name.
When I saw their documentation, it reads something like this...
Forcing Unique File Names
By default, AspUpload will overwrite existing files in the upload directory. If this is undesirable, the component can be configured to generate unique names for the files being uploaded to prevent overwriting existing files in the upload directory. This is done by setting UploadManager's OverwriteFiles property to False before calling Save:
Upload.OverwriteFiles = False
This property is True by default.
To prevent name collisions, AspUpload will append the original file name with an integer number in parentheses. For example, if the file MyFile.txt already exists in the upload directory, and another file with the same name is being uploaded, AspUpload will save the new file under the name MyFile(1).txt. If we upload more copies of MyFile.txt, they will be saved under the names MyFile(2).txt, MyFile(3).txt, etc.
But when I store the fileNames in the database, I am storing something like "C:\Upload\MyFile.Jpg".
This thanks to the component's Path property.
But when saving, if the component changes the filename, i.e, adds a number in paranthesis, how'd I update the database to reflect the value ? I hope you got my doubt..
Can you help me out of this??
Thank you...
RR