Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/09/2006, 14:25
yesmina
 
Fecha de Ingreso: diciembre-2004
Mensajes: 133
Antigüedad: 20 años, 4 meses
Puntos: 0
Problema con File Field

hola chicos,
tengo problemas con el control File Field, aqui les va el codigo:

EN HTML:
---------
<INPUT id="MyFile" style="Z-INDEX: 101; LEFT: 96px; POSITION: absolute; TOP: 48px" type="file" name="MyFile">

EN VB:
------
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim attach As String

attach = System.IO.Path.GetFileName(DirectCast(Me.FindContr ol("MyFile"), HtmlInputFile).PostedFile.FileName)

If attach <> "" Then
'guarda el archivo adjunto en la carpeta attachments situada en el directorio virtual de la aplicación
attach = "attachments/" + attach
DirectCast(Me.FindControl("MyFile"), HtmlInputFile).PostedFile.SaveAs(Server.MapPath(at tach))
End If

End Sub

MENSAJE DE ERROR:
-------------------
Referencia a objeto no establecida como instancia de un objeto.

en la linea:
attach = System.IO.Path.GetFileName(DirectCast(Me.FindContr ol("MyFile"), HtmlInputFile).PostedFile.FileName)

Otra aspecto es ke aun no tengo idea como podré renombrar el nombre del archivo con el ke lo subire al servidor.

Agradeceré su ayuda y sus sugerencias..
__________________
Mina

Última edición por yesmina; 13/09/2006 a las 14:26 Razón: para colocar un icono