ASP.NET - Mostrar solo ficheros pdf con FILEUPLOAD

 
Vista:

Mostrar solo ficheros pdf con FILEUPLOAD

Publicado por manuel  (1 intervención) el 30/12/2008 19:56:34
hola a todos, estoy haciendo una aplicacion en asp .net con visual basic, y utilizo el fileupload para cargar los archivos, quiero personalizarlo, que solo me aparezcan tipos de archivos pdf, urgente este tips, agradezco su colaboracion
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Mostrar solo ficheros pdf con FILEUPLOAD

Publicado por Vicente (12 intervenciones) el 06/01/2009 03:45:18
AHI TE DEJO TODO EL CODIGO

Protected Sub CmdSubirImagen_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles CmdSubirImagen.Click
Dim Ruta As String = ""
LblMsg.Text = ""
LblAccion.Text = ""
Dim Path As String = Server.MapPath(TxtDirSeccion.Text)
Dim ArchOK As Boolean = False
If FulSubir.FileName <> Me.CboReferencia.SelectedItem.Text & ".jpg" Then
Response.Write("<script>alert('El Archivo de imagen que seleccionó no coincide con la referencia que le fué asignada,Renombre su archivo de imagen y vuelva a intentar'); </script>")
Exit Sub
End If
If FulSubir.HasFile Then
Dim ExtensionArchivo As String
ExtensionArchivo = System.IO.Path. _
GetExtension(FulSubir.FileName).ToLower()
Dim ExtensionesValidas As String() = _
{".jpg"}
'PARA USAR MAS EXTENSIONES {".jpg", ".jpeg", ".png", ".gif"}
For i As Integer = 0 To ExtensionesValidas.Length - 1
If ExtensionArchivo = ExtensionesValidas(i) Then
ArchOK = True
End If
Next
If ArchOK Then
Try
FulSubir.PostedFile.SaveAs(Path & FulSubir.FileName)
LblAccion.Text = "El archivo ha sido cargado Felicidades"
Catch ex As Exception
LblAccion.Text = "El Archivo no pudo subir, contactenos"
End Try
Else
LblAccion.Text = "Solo se permite subir archivo con extension .jpg"
End If
End If
End Sub
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar