Answered by:
Save multipe file in database using ajax uploader

Question
-
User669521406 posted
Hello everyone
I'm trying to upload different images in my database by ajax file uploader, but i have a problem to how to save it as it contain different image which are upload in one go can someone help here are my code
<form id="form1" runat="server"> <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> </asp:ToolkitScriptManager> <div> <asp:Label runat="server" ID="myThrobber" Style="display: none;"><img align="absmiddle" alt="" src="images/uploading.gif"/></asp:Label> <asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server" onuploadcomplete="AjaxFileUpload1_UploadComplete" ThrobberID="myThrobber" MaximumNumberOfFiles="10" AllowedFileTypes="jpg,jpeg"/> </div> </form>
rotected Sub btnsubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsubmit.Click Dim s As Integer = DropDownList1.SelectedValue Dim available As String = "Available" Using conss As New SqlConnection(_start) Dim sql1 As String = "INSERT INTO Item (Name,Description,Quantity,Image1,SellerID,CategoryID,DateCreated,Price,Status) VALUES(@Name,@Description,@Quantity,@Image1,@seller,@cat,@Date,@price,@stat)" Dim myCommand1 = New SqlCommand(sql1, conss) conss.Open() myCommand1.Parameters.AddWithValue("@Name", TextBox1.Text) myCommand1.Parameters.AddWithValue("@Description", TextBox6.Text) myCommand1.Parameters.AddWithValue("@Quantity", TextBox3.Text) myCommand1.Parameters.AddWithValue("@Image1", filepath) myCommand1.Parameters.AddWithValue("@seller", temp) myCommand1.Parameters.AddWithValue("@cat", s) myCommand1.Parameters.AddWithValue("@Date", finaldate) myCommand1.Parameters.AddWithValue("@price", TextBox2.Text) myCommand1.Parameters.AddWithValue("@stat", available) myCommand1.ExecuteNonQuery() End Protected Sub AjaxFileUpload1_UploadComplete(ByVal sender As Object, ByVal e As AjaxControlToolkit.AjaxFileUploadEventArgs) Handles AjaxFileUpload1.UploadComplete Dim filePath As String = "~/Seller/images/" & Convert.ToString(e.FileName) AjaxFileUpload1.SaveAs(filePath)
Friday, December 27, 2013 5:15 AM
Answers
-
User-933407369 posted
hi Jdaniel13,
you had posted the similar thread: http://forums.asp.net/t/1958615.aspx
Please take care of it , i had posted a new reply on there.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, December 31, 2013 1:32 AM
All replies
-
Sunday, December 29, 2013 10:32 PM
-
User-933407369 posted
hi Jdaniel13,
you had posted the similar thread: http://forums.asp.net/t/1958615.aspx
Please take care of it , i had posted a new reply on there.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, December 31, 2013 1:32 AM