This is a migrated thread and some comments may be shown as answers.

Upload Overwrite Prompt

1 Answer 123 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
AdamL
Top achievements
Rank 1
AdamL asked on 08 May 2008, 05:54 PM
I have not been able to find a decent solution for this issue:

I am allowing the user to upload files from my application.  If the user attempts to upload a file that exists, I want to prompt them with the opportunity to overwrite the file or cancel the operation.

Any suggestions?

Thanks,

- Adam

1 Answer, 1 is accepted

Sort by
0
Sophy
Telerik team
answered on 10 May 2008, 12:07 PM
Hi Adam,

File existence can be validated only server-side. You can use the FileExists server event of the RadUpload control to check whether the corresponding file exists and display a message which prompts the user to choose whether to override the file or do not save it. I suggest you take a look at the FileExists help aricle for reference. However, in both cases the file will be upload to the server and the depending on the user's response the existing file will be overridden or the file will not saved.

If you want to avoid uploading the file in case the user do not want to save it we suggest you at upload button click make an AJAX call(the files cannot be uploaded with AJAX) to the server with the selected file name and check if the file exists on the server. You can then return true/false back to the JavaScript and prompt the user to select one of the two options and depending on his response submit the whole page to upload the files or cancel the upload. Information about canceling uploading you can find in the Preventing Uploads help article.

All the best,
Sophy
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Upload (Obsolete)
Asked by
AdamL
Top achievements
Rank 1
Answers by
Sophy
Telerik team
Share this question
or