Upload images through SWF upload and access them on form post

Apr 9, 2014 at 2:12 PM

I need a small help. Thank you very much for having a look at my query.

I have a strongly-typed view in MVC3 with few input fields in form tag. I want to allow my users to upload images along with this form. Accordingly I used SWF upload on the same form. Upload functionality working perfect where I am saving images on disk and saving image path in session variables as:

HttpContext.Session["Image1"] = image1Path;

HttpContext.Session["Image2"] = image2Path;

and so on.....

Now when I submit this form, I am trying to retrieve image path stored in above session variable in this form's action method as:

var imagePath = HttpContext.Session["Image1"].ToString();

but I am getting HttpContext.Session["Image1"] as null.

This is working on production somehow but not on localhost through Visual Studio. Initially I though that it might be due to httpCookies domain set in config file. But it doesn't work even after commenting this tag:
<!--<httpCookies domain="xyz.com" httpOnlyCookies="true" />--> Please suggest me where I am going wrong or is there any better way to achieve this task.

SUMMERY: how to access file path uploaded by ajax call in main form submit.