Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Save multipe file in database using ajax uploader

$
0
0

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>
rotectedSub btnsubmit_Click(ByVal sender AsObject,ByVal e AsSystem.EventArgs)Handles btnsubmit.ClickDim s AsInteger=DropDownList1.SelectedValueDim available AsString="Available"Using conss AsNewSqlConnection(_start)Dim sql1 AsString="INSERT INTO Item (Name,Description,Quantity,Image1,SellerID,CategoryID,DateCreated,Price,Status) VALUES(@Name,@Description,@Quantity,@Image1,@seller,@cat,@Date,@price,@stat)"Dim myCommand1 =NewSqlCommand(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()EndProtectedSubAjaxFileUpload1_UploadComplete(ByVal sender AsObject,ByVal e AsAjaxControlToolkit.AjaxFileUploadEventArgs)HandlesAjaxFileUpload1.UploadCompleteDim filePath AsString="~/Seller/images/"&Convert.ToString(e.FileName)AjaxFileUpload1.SaveAs(filePath)

Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>