ASP.Net C# File Upload Problem Help ???
Guys I Receive An Error it Says
Can Anyone Help Me ??? Urgent, Thank You
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Gowtham RajamanickamPosted Apr 10, 2015, 1:25 PM
g sPosted Apr 6, 2015, 9:09 AM
http://dotnetdrizzles.blogspot.in/2014/09/image-insert-upload-bind-gridview-using.html
http://screenshotdrizzles.blogspot.in/2014/10/image-insert-upload-bind-gridview-using.html
Eric SebastianPosted Apr 6, 2015, 3:09 AM
Khargesh RajputPosted Apr 6, 2015, 2:56 AM
Eric SebastianPosted Apr 6, 2015, 2:47 AM
Khargesh RajputPosted Apr 6, 2015, 2:41 AM
The name 'FileUploadControl' does not exist
thats caused by Fileupload control ID
In your aspx What is control id
put same name as in cs page
com.Parameters.AddWithValue("@File", FileUpload1.FileName);
Eric SebastianPosted Apr 6, 2015, 2:37 AM
Khargesh RajputPosted Apr 6, 2015, 2:33 AM
namespaces added on the top ,
read more about namespaces in c# from google
Eric SebastianPosted Apr 6, 2015, 2:25 AM
Khargesh RajputPosted Apr 6, 2015, 12:31 AM
and
for Path you have to add namespace
Using System.IO;
Eric SebastianPosted Apr 5, 2015, 10:02 PM
and also "The name 'FileUploadControl' does not exist in the current context"
Please Help me Urgent , thank you
Saber ShaikhPosted Apr 2, 2015, 5:44 AM
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["InventoryConnectionString"].ConnectionString);
conn.Open();
string filename = Path.GetFileName(FileUploadControl.FileName);
string insert = "insert into Transaksi (No_Serial, Nama_Karyawan, Departemen, Jabatan, IWR_No, Lokasi, File, Keterangan) values (@Seri2, @NmKar, @Dep, @Jab, @IWR, @Lok, @File, @Ket)";
SqlCommand com = new SqlCommand(insert, conn);
com.Parameters.AddWithValue("@Seri2", Serial.Text);
com.Parameters.AddWithValue("@NmKar", Karyawan.Text);
com.Parameters.AddWithValue("@Dep", DropDownList1.SelectedItem.ToString());
com.Parameters.AddWithValue("@Jab", Jabatan.Text);
com.Parameters.AddWithValue("@IWR", IWR.Text);
com.Parameters.AddWithValue("@Lok", DropDownList2.SelectedItem.ToString());
com.Parameters.AddWithValue("@File", filename);
com.Parameters.AddWithValue("@Ket", Ket.Text);
com.ExecuteNonQuery();
Response.Redirect("Transaksi.aspx");
conn.Close();
}
Khargesh RajputPosted Apr 2, 2015, 5:28 AM
string insert = "insert into Transaksi (No_Serial, Nama_Karyawan, Departemen, Jabatan, IWR_No, Lokasi, File, Keterangan) values (@Seri2, @NmKar, @Dep, @Jab, @IWR, @Lok, @File, @Ket)";
please check your query in sql
Eric SebastianPosted Apr 2, 2015, 3:13 AM
Incorrect syntax near the keyword 'File'.
Khargesh RajputPosted Apr 2, 2015, 2:56 AM
here is problem
com.Parameters.AddWithValue("@File", FileUpload1);
write filename
com.Parameters.AddWithValue("@File", FileUpload1.FileName);
Eric SebastianPosted Apr 2, 2015, 2:50 AM
Khargesh RajputPosted Apr 2, 2015, 12:57 AM
I think you have write only Fileupload in cs page
Instead of fileupload.filename