i have a asp.net mvc application which uploads several xml files that are used to import data into the sql server db. I want to upload all the files one by one so i dont overload the web server(the xml files can be up to 50Mb). What is the best way to make sure that the user does not import each xml file more than once? Tee thing is i am not allowed to save the files on the web server?
1 Answer
When you are inserting data into the database isn't there some unique information into those XML files allowing you to know whether you already inserted a record with it? Something like an id or other that is unique for each XML file. Another possibility is to calculate the SHA1 checksum of each uploaded file and store an array of all checksums somewhere on the server (Session or something if you are not allowed to store the entire files). Then when the user uploads a file calculate its checksum and verify if it is present in the collection.