I am just starting to do few web application and I have 2 questions to ask..Does anyone know how to count the number of files inside a folder? I am currently creating an application where I can upload images to my website. Whatever the image name is, it has to be renamed to a number before it is saved in the destination folder. That number would be to keep track of how many files will be there in the folder..For example if the new file being uploaded is 64th file, then irrespective of file name, the file should be renamed as 64.jpeg and then be saved in the folder.
If this is impossible, can anyone help me making this work with a SQL database perhaps..My idea is If the database can have the folder name and the corresponding number of files in it, when ever this file upload feature is used, the database would be accessed and the number of files in a particular folder can be known..After renaming the new file, the number of files in that folder would be incremented by 1 and that info will be updated in the database..I know how to insert data into SQL server..But I have no idea how to select data from database and use it for future calculations..I mean I don't know how to assign that returned(selected) value to either a textbox or a variable..Any valuable help would be appreciated...I am using C# for programming..I have done the image upload part..but this renaming part is really difficult for me..Please help