I am using the code in this link below.
I am trying to save the uploaded images to a database after user complete his changes (deleting, replacing adding pictures).
http://jsfiddle.net/WCCM7/17/[
^]
I tried with this code below but it is not reflecting any changes by the user for example if the user select 3 pictures preview them and delete one of them and the submit to server (
code behind not the one this code is using) then in the code behind if you check the
HttpFileCollection fileCollection = Request.Files;
it will have all 3 pictures.
But the array in the JavaScript named
thumbsArray
have the exact number remaining 2 pictures.
I could not access that array from code behind with a hiddenfield, I do not know what I am missing.
Please I need your help
string folderName;
protected void Page_Load(object sender, EventArgs e)
{
ddlLocation.Items.Insert(0, new ListItem("--Select a location--", "-1"));
folderName = Path.Combine(Server.MapPath("~/test/"), "Top-Level Folder");
System.IO.Directory.CreateDirectory(folderName);
Response.Write("this it the hidden field value page load"+HiddenField1.Value);
}
protected void Button1_Click(object sender, EventArgs e)
{
HttpFileCollection fileCollection = Request.Files;
for (int i = 0; i < fileCollection.Count; i++)
{
HttpPostedFile postedFile = fileCollection[i];
if (postedFile.ContentLength > 0)
{
string filePath = Path.Combine(folderName, Path.GetFileName(postedFile.FileName));
postedFile.SaveAs(filePath);
}
}
Response.Write("this it the hidden field value button click" + HiddenField1.Value);
}