First add the following HTML tag
input id="Upload" style="Z-INDEX: 102; LEFT: 104px; WIDTH: 288px; POSITION: absolute; TOP: 64px; HEIGHT: 22px" type="file" size="28" name="Upload" runat="server"
Create a Button called "Upload", add the code below on the click event of your button :
private void Button1_Click(object sender, System.EventArgs e)
{
//It verifies if the archive exists
if (Upload.PostedFile != null)
{
//To create a PostedFile
HttpPostedFile File = Upload.PostedFile;
//Create byte Array with file len
byte[] Data = new Byte[File.ContentLength];
//force the control to load data in array
File.InputStream.Read(Data,0,File.ContentLength);
//Create procedure parameter
object[] obj = new object[1];
obj[0] = Data;
//put here your databasecode code
//MyDataset.MyTable.M) AS insert into tb_img values(@img)*/
//SqlHelper.ExecuteNonQuery(connectionString,"sp_img",obj);
}
}
Aucun commentaire:
Enregistrer un commentaire