Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
505
How to handle if the uploaded file already exists on server?
posted

Hi,

I am using Infragistics Upload control in Asp.net MVC3 application, my question is how to handle if the uploaded file already exists on server? I see that for default setting the new uploaded file will overwrite the existing one on server.

And I learned from the following topic that we can add handler in Global.asax or controller. 

"How to add time stamp to the uploading file name using Webupload?"

http://blogs.infragistics.com/forums/p/60533/307286.aspx

 

I added some code  in Global.asax to change the file name if it exists, but how do I know the changed file name on client side? For example, if the file name is abc.txt, server code may changed it to abc20120529.txt, how does the client javascript know the new file name, since I need save it to database.

 

 

 

Parents
No Data
Reply
  • 7566
    posted

    Hi Buick1980,

     

    If you change the names of the files when you upload them you will not be able to determine whether this file exist on the server or not.

    You can use the session state or to cache all the file names of the files uploaded and to check OnUploadStarting if this file names exist on the server, if yes you can cancel this event to prevent uploading same files.

     

    If you need any further assistance or you have any questions do not hesitate to contact me.

     

    Sincerely,

    Georgi Sashev

    Developer Support Engineer

    Infragistics, Inc.

    http://ko.infragistics.com/support

Children
No Data