how can i save the file using c# into the SQL server dataqbase after user has selected the file location using fileupload control in asp.net.
Please look into this article Save Files to SQL Server Database using FileUpload Control
I would love if you first search on gooogle and than ask for the help if you find out difficult to understand anyways check the following article help you to achieve your task
You might try something like this:
if (this.fileUploader.PostedFile == null ||
this.fileUploader.PostedFile.ContentLength < 1)
{
this.LabelError.Text = this.GetGlobalResourceObject("Messages", "NoFileToUpload")
.ToString();
return;
}
MyTableWithImageField i = new MyTableWithImageField();
i.ImageData = this.fileUploader.FileBytes;
command.CommandText = @"InsertMyTableWithImageField";
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("@ImageData", i.ImageData);
You may also want to check this from MSDN: Uploading Files in ASP.NET 2.0
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.