I have a product page. I want to add my product to my database, and I want to update my product as well. I have a problem with images. When I insert an everithing product, this is normal. On my aspx page, I have this code:
<span> <asp:FileUpload ID="files" runat="server" AllowMultiple="true" /> </span> <div runat="server" id="previewImages"></div>
and when I save my product, in the code behind I have this code:
string filenm = string.Empty; HttpFileCollection fileCollection = Request.Files; for (int i = 0; i < fileCollection.Count; i++) { HttpPostedFile uploadfile = fileCollection[i]; if (uploadfile.ContentLength > 0) { string filename = uploadfile.FileName; System.IO.Directory.CreateDirectory(Server.MapPath("immScarpe/" + txtStyle.Text)); file.SaveAs(Server.MapPath("immScarpe/" + txtStyle.Text + "/") + fileName);
Now the problem is that I can CHANGE the saved product. When I click the edit button for a product, I have to load all its data and let the user modify it. Also images.
The main question: how to load saved images in asp: FileUpload control?
Another thing I would like to do is show preview images of images ... insert and edit.
An example of what I want to do is what Amazon does
but if possible with only one file loader with AllowMultiple = true
I am ready to use other technologies such as javascript, jquery and Ajax, if necessary
source share