ASP.Net MVC input file control event after file selection

dodgerfan
dodgerfan used Ask the Experts™
on
I have an ASP.Net MVC application. One of my views has a input file control that users use to select a file to upload to a database. After the user selects a file but BEFORE they click the upload button, I'd like to run some code from the controller on the file. Is there a way to do this? It's a simple input control: <input type="file" name="postedfile" /> Any help is appreciated.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior Software Engineer
Top Expert 2009
Commented:
I do not think it is possible, because your are not suppose to alter files in an external PC. (otherwise imagine the number of files people could manipulate.
If more help neede please provide answers to:
Q1. What you could do though is in the controller action run whatever you need to run in the file before saving in into your system.
What exactly are you planning to do? if it is size validation that should be easy to implement in the controller action  and just return the view with a warning message.
Q2. What code have you got so far? Controller and View/Model

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial