¿no encuentra el archivo?
Publicado por Silvia (185 intervenciones) el 18/12/2005 12:32:08
Os explico yo tengo este codigo que lo que hace es localizar la ruta en el disco duro local donde se encuentra la imagen antonio.jpg y despues la guarda con otro nombre y la reduce de tamaño.
Bien localmente funciona perfecto con este codigo:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ruta As String
ruta = "C:\ftptomas\IMAGENES\antonio.jpg"
Dim original As System.Drawing.Image = System.Drawing.Image.FromFile(ruta)
TextBox1.Text = (original.Size.Width).ToString
TextBox2.Text = (original.Size.Height).ToString
Dim B As Integer
Dim C As Integer
Select Case TextBox1.Text
Case Is > TextBox2.Text
B = 400
C = 300
Case Is < TextBox2.Text
B = 300
C = 400
Case Is = TextBox2.Text
B = 400
C = 400
End Select
Dim imagen As New System.Drawing.Bitmap(original, B, C)
Dim grafico As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(imagen)
imagen.Save"C:\ftptomas\imagenes\hel9jo9u.jpg",System.Drawing.Imaging.ImageFormat.Jpeg)
end sub
Pero cuando subo esto al servidor me da el siguiente error:
Server Error in '/' Application.
--------------------------------------------------------------------------------
C:\ftptomas\IMAGENES\antonio.jpg
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.IO.FileNotFoundException: C:\ftptomas\IMAGENES\antonio.jpg
Source Error:
Line 9: ruta = "C:\ftptomas\IMAGENES\antonio.jpg"
Line 10: ' Dim original As New System.Drawing.Bitmap(ruta)
Line 11: Dim original As System.Drawing.Image = System.Drawing.Image.FromFile(ruta)
Line 12:
Line 13: TextBox1.Text = (original.Size.Width).ToString
Source File: d:\users\madeinspain1-1\Default.aspx.vb Line: 11
Stack Trace:
[FileNotFoundException: C:\ftptomas\IMAGENES\antonio.jpg]
System.Drawing.Image.FromFile(String filename, Boolean useEmbeddedColorManagement) +380066
System.Drawing.Image.FromFile(String filename) +6
_Default.Button1_Click(Object sender, EventArgs e) in d:\users\madeinspain1-1\Default.aspx.vb:11
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
No se porque da este error si el archivo local sigue existiendo
Gracias.
Bien localmente funciona perfecto con este codigo:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ruta As String
ruta = "C:\ftptomas\IMAGENES\antonio.jpg"
Dim original As System.Drawing.Image = System.Drawing.Image.FromFile(ruta)
TextBox1.Text = (original.Size.Width).ToString
TextBox2.Text = (original.Size.Height).ToString
Dim B As Integer
Dim C As Integer
Select Case TextBox1.Text
Case Is > TextBox2.Text
B = 400
C = 300
Case Is < TextBox2.Text
B = 300
C = 400
Case Is = TextBox2.Text
B = 400
C = 400
End Select
Dim imagen As New System.Drawing.Bitmap(original, B, C)
Dim grafico As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(imagen)
imagen.Save"C:\ftptomas\imagenes\hel9jo9u.jpg",System.Drawing.Imaging.ImageFormat.Jpeg)
end sub
Pero cuando subo esto al servidor me da el siguiente error:
Server Error in '/' Application.
--------------------------------------------------------------------------------
C:\ftptomas\IMAGENES\antonio.jpg
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.IO.FileNotFoundException: C:\ftptomas\IMAGENES\antonio.jpg
Source Error:
Line 9: ruta = "C:\ftptomas\IMAGENES\antonio.jpg"
Line 10: ' Dim original As New System.Drawing.Bitmap(ruta)
Line 11: Dim original As System.Drawing.Image = System.Drawing.Image.FromFile(ruta)
Line 12:
Line 13: TextBox1.Text = (original.Size.Width).ToString
Source File: d:\users\madeinspain1-1\Default.aspx.vb Line: 11
Stack Trace:
[FileNotFoundException: C:\ftptomas\IMAGENES\antonio.jpg]
System.Drawing.Image.FromFile(String filename, Boolean useEmbeddedColorManagement) +380066
System.Drawing.Image.FromFile(String filename) +6
_Default.Button1_Click(Object sender, EventArgs e) in d:\users\madeinspain1-1\Default.aspx.vb:11
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
No se porque da este error si el archivo local sigue existiendo
Gracias.
Valora esta pregunta


0