sahele_sheni
سه شنبه 05 آبان 1388, 18:48 عصر
سلام دوستان . برای آپلود فایلها از این کد استفاده میکنم
If (Me.fileupload1.Value <> "") Then
Dim imagefilename As String
tblimageadapter.FillByname(dataset.tbl_image, My.Computer.FileSystem.GetName(fileupload1.Value))
imagefilename = My.Computer.FileSystem.GetName(fileupload1.Value)
Dim filepath As String = Server.MapPath("addimage.aspx")
Dim mlen As Integer = Len(filepath)
filepath = filepath.Substring(0, mlen - 20)
While (dataset.tbl_image.Rows.Count = 1)
imagefilename = "0" + imagefilename
tblimageadapter.FillByname(dataset.tbl_image, imagefilename)
End While
Dim savefile As String
savefile = filepath + "pic\" + imagefilename
fileupload1.PostedFile.SaveAs(savefile)
tblimageadapter.Fill(dataset.tbl_image)
Dim idcounter As Integer = dataset.tbl_image.Rows.Count
tblimageadapter.Insert(imagefilename, Trim(imagename.Text), Trim(imagecomment.Text), idcounter + 1)
End If
روی سیستم خودم جواب میده ولی وقتی میبرم روی هاست این اشکال رو میگیره
Input string was not in a correct format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: Input string was not in a correct format.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[FormatException: Input string was not in a correct format.]
Microsoft.VisualBasic.CompilerServices.Conversions .ParseDouble(String Value, NumberFormatInfo NumberFormat) +201
Microsoft.VisualBasic.CompilerServices.Conversions .ToInteger(String Value) +66
[InvalidCastException: Conversion from string "Could not find a part of the pat" to type 'Integer' is not valid.]
Microsoft.VisualBasic.CompilerServices.Conversions .ToInteger(String Value) +246
manage_addimage.ImageButton1_Click(Object sender, ImageClickEventArgs e) +621
System.Web.UI.WebControls.ImageButton.OnClick(Imag eClickEventArgs e) +108
System.Web.UI.WebControls.ImageButton.RaisePostBac kEvent(String eventArgument) +118
System.Web.UI.WebControls.ImageButton.System.Web.U I.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082
ممکنه راهنمایی کنید اشکال کار من چیه !؟
If (Me.fileupload1.Value <> "") Then
Dim imagefilename As String
tblimageadapter.FillByname(dataset.tbl_image, My.Computer.FileSystem.GetName(fileupload1.Value))
imagefilename = My.Computer.FileSystem.GetName(fileupload1.Value)
Dim filepath As String = Server.MapPath("addimage.aspx")
Dim mlen As Integer = Len(filepath)
filepath = filepath.Substring(0, mlen - 20)
While (dataset.tbl_image.Rows.Count = 1)
imagefilename = "0" + imagefilename
tblimageadapter.FillByname(dataset.tbl_image, imagefilename)
End While
Dim savefile As String
savefile = filepath + "pic\" + imagefilename
fileupload1.PostedFile.SaveAs(savefile)
tblimageadapter.Fill(dataset.tbl_image)
Dim idcounter As Integer = dataset.tbl_image.Rows.Count
tblimageadapter.Insert(imagefilename, Trim(imagename.Text), Trim(imagecomment.Text), idcounter + 1)
End If
روی سیستم خودم جواب میده ولی وقتی میبرم روی هاست این اشکال رو میگیره
Input string was not in a correct format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: Input string was not in a correct format.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[FormatException: Input string was not in a correct format.]
Microsoft.VisualBasic.CompilerServices.Conversions .ParseDouble(String Value, NumberFormatInfo NumberFormat) +201
Microsoft.VisualBasic.CompilerServices.Conversions .ToInteger(String Value) +66
[InvalidCastException: Conversion from string "Could not find a part of the pat" to type 'Integer' is not valid.]
Microsoft.VisualBasic.CompilerServices.Conversions .ToInteger(String Value) +246
manage_addimage.ImageButton1_Click(Object sender, ImageClickEventArgs e) +621
System.Web.UI.WebControls.ImageButton.OnClick(Imag eClickEventArgs e) +108
System.Web.UI.WebControls.ImageButton.RaisePostBac kEvent(String eventArgument) +118
System.Web.UI.WebControls.ImageButton.System.Web.U I.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082
ممکنه راهنمایی کنید اشکال کار من چیه !؟