The fileUpload looses the file on postback. Therefore the file will be lost when I get the OK from the user. I have tried to put this in Ajax Upload panel but that caused the fileUpload to stop working.
Main Topics
Browse All TopicsI have a page with multiple textboxes and two file uploads. When the user has entered his data into all the fields I have one submit button to save all the data.
I want to check if there exists a file with the same name as entered in the file upload and if so I want to alert the user so he can either continue and overwrite the file or cancel. Can anyone explain to me how to make this messagebox?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Using AJAX you can avoid the "postback" event altogether. If it is all inside an update panel, the file control should retain it's settings. Would something along the lines of Javascript and a webservice to check for the file existance work out? I am envisioning something like a hidden button which causes a postback where you can handle the file upload, and the visible button causing an AJAX call to the server function (webservice?) which returns true or false with the filename (document.getElementByID("
If you could post your page (HTML) and codebehind, I think I should be able to work it out for you on Monday evening.
Geoff
Business Accounts
Answer for Membership
by: GeoffSuttonPosted on 2008-09-25 at 19:05:27ID: 22575922
You need to create a popup window of some sort (ASP Panel element with a set size and a background color. Put a message on the panel "This file exists. Click OK to overwrite it, cancel to quit" then having an ok and a cancel button.
exists on the server. If it does, set the visible property of the panel to "True" and end the function. If it does not, call the handler for the OK button on the popup. This handler will 1) Set the panel to invisible again and 2) save the file, overwriting the current on. The cancel button will merely hide the popup window.
Then on the initial upload of ths file(I'd recommend using ASP.NET Ajax with an update panel to avoid page flickering) run a check to see if filecontrol.postedfilename
I didn't give exact code, but merely a walkthrough of how it is done. The code completion in ASP.NET should give you the correct syntax easily enough. This was merely a walkthrough of method to follow on how to accomplish it.
Good luck.