FileUpload Control Use in Wizard Control!

07 Sep

i have problem face when i use File Upload Control in Wizard Control.When i use multiple Step in Wizard control and Fileupload Control use at First Step,When i reach at last step then Submit The Information for Save then FileUpload Control Empty or No File.So,The Image Not Save in Database and in Directory.

after to much  Search on Net but i Can’t Found solution.After deeply workout then i reach to find the solution.


At First Next Step you write the File Upload Code Like

string _ImgName = string.Empty;

//Set Directory Path in Web.config Fiel ,just change Folder Name from  WebConfig
string folderPath = ConfigurationManager.AppSettings.Get(“ImagePath”);

string ImgPathimg = Request.PhysicalApplicationPath + folderPath;
fuPicture.EnableViewState = true;
if (fuPicture != null && fuPicture.HasFile)

_ImgName = System.IO.Path.GetFileName(fuPicture.PostedFile.FileName);

// This is use for  Unique Path for every document
string name = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + “_”;

string _imgrnd = name + _ImgName;
ImgPathimg = ImgPathimg + _imgrnd;
string name1 = _imgrnd;
ViewState[“ImagePath”] = ImgPathimg;
//  fuPicture.SaveAs(ImgPathimg);
// reg.PicturePath = _imgrnd;
ViewState[“ImageName”] = _imgrnd;

WizaApplyOnline.ActiveStepIndex = 1;


Save Image Path in View State

ViewState[“ImagePath”] = ImgPathimg;

Save Image Name

ViewState[“ImageName”] = _imgrnd;

After  Going Next Step



Last Step write this Code……….

if (ViewState[“ImageName”] != null && ViewState[“ImageName”] != string.Empty)
//   reg.PicturePath = _imgrnd;
reg.PicturePath = ViewState[“ImageName”].ToString();

else {
reg.PicturePath = “”;


your Problem resolve

1 Comment

Posted by on September 7, 2010 in ASP Dot Net C#


One response to “FileUpload Control Use in Wizard Control!

  1. Rabeek Ahamed

    January 30, 2012 at 1:55 pm

    Check the below url to get the fileupload postedfile during postback:


Leave a Reply to Rabeek Ahamed Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: