Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

ASP.Net page with input file ( every button uploads file, how do I prevent )

Posted on 2005-05-10
5
Medium Priority
?
327 Views
Last Modified: 2010-04-07
I have an asp.net page built with controls and linkbuttons all over the place. Every link or button on the page posts my one form to the server. This page also has a file input html control, and now all the buttons on page tries to upload the file, when I would only want this to happen if the submit button is pressed.

Is there any .net way to disable the file upload when certain control events are thrown?

bd
0
Comment
Question by:brooklynDev
  • 2
3 Comments
 
LVL 33

Accepted Solution

by:
raterus earned 2000 total points
ID: 13972480
you can implement some of the logic mentioned here to disable the file control right before you postback: http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/ASP_DOT_NET/Q_21415149.html#13945280

looks something like this in the submit handler of the other controls that can postback:
document.getElementById('myFile').disabled = true; return true;

Also, why can't the file control just remain blank, it can't upload what hasn't been selected by the end user!

0
 

Expert Comment

by:sethUSer420
ID: 13972557
That solution looks promising, I'll try it now

raterus, to answer your question, the control can remain blank, I just want the cancel button to clear the elements of the form without uploading the file if one has been selected.
0
 

Expert Comment

by:sethUSer420
ID: 13977412
I read through your terms and conditions, yes, please delete my old account

sorry about the confusion, was an accident
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Screencast - Getting to Know the Pipeline
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month13 days, 5 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question