rahul.deshmukh
rahul.deshmukh

Reputation: 590

how to get or retain file upload control value after postback

hi i have usercontrol on which there is one file upload control, user control is inside Tab container which on aspx page.hirarchy is like bellow:

1.Master Page 2.aspx Page having ajax tab control. 3.User control which is inside tab container. 4.file upload control which is on user control. and submit button

Problem i am facing: When i click on submit button as page load event is called before buttons on click event value of file upload control is getting nulll.

could you please tell me how can i fetch the file upload control value after postback. thanks is advance.

Upvotes: 0

Views: 4628

Answers (1)

nunespascal
nunespascal

Reputation: 17724

The file upload control does not retain the posted file with each request.
When the user selects a file, it will be available in the next PostBack request that occurs.

You should check for a PostedFile on each postback and save this file on the server.
Keep a reference to its path in the ViewState.
Then you can process the file when the user has finished all inputs.

Upvotes: 1

Related Questions