我在visual studio 2010中使用c1上传(组件1)。它在调试时工作,但在localhost上不起作用。我在组件一中使用4.0.20113.47版本。请建议我如何解决问题?
protected void C1Upload_sample_ValidatingFile(object sender, C1.Web.Wijmo.Controls.C1Upload.ValidateFileEventArgs e)
{
string sample_code = txt_code.Text;
if (sample_code == "")
{
return;
}
try
{
var s = e.UploadedFile.GetStream();
byte[] imgbyte = new byte[s.Length];
s.Read(imgbyte, 0, Convert.ToInt32(s.Length));
//sample image upload into c1caurosel
cmd = new SqlCommand("sp_pdm_shopping_upload", con);
cmd.CommandType = CommandType.StoredProcedure;
con.Open();
cmd.Parameters.Add(new SqlParameter("@sample", SqlDbType.Char, 10));
SqlParameter contentparameter = null;
contentparameter = (new SqlParameter("@image", SqlDbType.Image));
contentparameter.Direction = ParameterDirection.Input;
cmd.Parameters.Add(contentparameter);
cmd.Parameters.Add(new SqlParameter("@type", SqlDbType.Char, 10));
cmd.Parameters["@sample"].Value = txt_code.Text;
cmd.Parameters["@image"].Value = imgbyte;
cmd.Parameters["@type"].Value = "IMG";
cmd.ExecuteNonQuery();
con.Close();
getuploadimage();
e.IsValid = false;
s.Close();
e.UploadedFile.Delete();
}
catch
{
return;
}
}