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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Khargesh RajputRank #616 · 3.9K reputationPosted Apr 1, 2015, 8:57 PM EDT
I think you have write only Fileupload in cs page
Instead of fileupload.filename
Eric Sebastian27 reputationPosted Apr 1, 2015, 10:50 PM EDT
Khargesh RajputRank #616 · 3.9K reputationPosted Apr 1, 2015, 10:56 PM EDT
here is problem
com.Parameters.AddWithValue("@File", FileUpload1);
write filename
com.Parameters.AddWithValue("@File", FileUpload1.FileName);
Eric Sebastian27 reputationPosted Apr 1, 2015, 11:13 PM EDT
Incorrect syntax near the keyword 'File'.
Khargesh RajputRank #616 · 3.9K reputationPosted Apr 2, 2015, 1:28 AM EDT
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
Saber ShaikhRank #1,687 · 905 reputationPosted Apr 2, 2015, 1:44 AM EDT
{
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();
}
Eric Sebastian27 reputationPosted Apr 5, 2015, 6:02 PM EDT
and also "The name 'FileUploadControl' does not exist in the current context"
Please Help me Urgent , thank you
Khargesh RajputRank #616 · 3.9K reputationPosted Apr 5, 2015, 8:31 PM EDT
and
for Path you have to add namespace
Using System.IO;
Eric Sebastian27 reputationPosted Apr 5, 2015, 10:25 PM EDT
Khargesh RajputRank #616 · 3.9K reputationPosted Apr 5, 2015, 10:33 PM EDT
namespaces added on the top ,
read more about namespaces in c# from google
Eric Sebastian27 reputationPosted Apr 5, 2015, 10:37 PM EDT
Khargesh RajputRank #616 · 3.9K reputationPosted Apr 5, 2015, 10:41 PM EDT
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 Sebastian27 reputationPosted Apr 5, 2015, 10:47 PM EDT
Khargesh RajputRank #616 · 3.9K reputationPosted Apr 5, 2015, 10:56 PM EDT
Eric Sebastian27 reputationPosted Apr 5, 2015, 11:09 PM EDT
g s102 reputationPosted Apr 6, 2015, 5:09 AM EDT
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
Gowtham RajamanickamRank #57 · 29K reputationPosted Apr 10, 2015, 9:25 AM EDT