How to check for duplicates before uploading.
-
Hi! I have a small upload site that I have built but one thing I can't work out is how to check to see if the file path has already been used. When I upload just now I create a website address which is saved in doc_url within my table. What I want to check is that when uploading a new file, there isnt already an identical url created within doc_url. If there is already a file within the database with the same path then I want to throw up an error message so the user knows there is already a file saved at this location with the same name. I'm using VS2005, C#, ASP.net Thanks for your help in advance.
-
Hi! I have a small upload site that I have built but one thing I can't work out is how to check to see if the file path has already been used. When I upload just now I create a website address which is saved in doc_url within my table. What I want to check is that when uploading a new file, there isnt already an identical url created within doc_url. If there is already a file within the database with the same path then I want to throw up an error message so the user knows there is already a file saved at this location with the same name. I'm using VS2005, C#, ASP.net Thanks for your help in advance.
add a random numder like doc_url_randomNumber.
Prince Team Lead Quest Solutions www.imaginethinkact.com
-
add a random numder like doc_url_randomNumber.
Prince Team Lead Quest Solutions www.imaginethinkact.com
But that means there are two files the exact same within the database, what I want is to have only 1 version of the url which means, one version of the file I have uploaded. To explain a bit more, when I upload a file e.g. example.gif to a folder I automatically create a url e.g. http://localhost/folder1/example.gif Now, if I upload a file with the exact same name to the exact same folder I want a message to be displayed saying, there is already a file with this name in this folder.
-
But that means there are two files the exact same within the database, what I want is to have only 1 version of the url which means, one version of the file I have uploaded. To explain a bit more, when I upload a file e.g. example.gif to a folder I automatically create a url e.g. http://localhost/folder1/example.gif Now, if I upload a file with the exact same name to the exact same folder I want a message to be displayed saying, there is already a file with this name in this folder.
Just loop through that folder and compare the file names with your new filename. upload only when result is "no match found".
Prince Team Lead Quest Solutions www.imaginethinkact.com
-
Hi! I have a small upload site that I have built but one thing I can't work out is how to check to see if the file path has already been used. When I upload just now I create a website address which is saved in doc_url within my table. What I want to check is that when uploading a new file, there isnt already an identical url created within doc_url. If there is already a file within the database with the same path then I want to throw up an error message so the user knows there is already a file saved at this location with the same name. I'm using VS2005, C#, ASP.net Thanks for your help in advance.
Very simple! You can handle that as below: string filePath = Server.MapPath("~/folder1/example.gif"); if (File.Exists(filePath)) { //show a message to the user }
Welcome to www.softwaretree.net! You can find many excellent audio/video converter tools there!
-
Very simple! You can handle that as below: string filePath = Server.MapPath("~/folder1/example.gif"); if (File.Exists(filePath)) { //show a message to the user }
Welcome to www.softwaretree.net! You can find many excellent audio/video converter tools there!
How would I loop through a database to check all entries in a single column before submitting? Sorry if these are easy questions, still learning .Net but everything I learn gets stored in a safe place for future reference :) Thanks for your continued help!