
19/05/2005, 09:02
|
 | | | Fecha de Ingreso: febrero-2005
Mensajes: 539
Antigüedad: 20 años Puntos: 1 | |
Yo trabajo con el firefox y utilizo esto para subirlo al servidor y guardarlo en una carpeta:
Function SaveFile() As Boolean
If CheckFile() = True Then
Dim Fname As String = System.IO.Path.GetFileName(file1.PostedFile.FileNa me)
'file1.PostedFile.SaveAs(Server.MapPath("Descarga\ " & Fname)) '// ruta relativa
file1.PostedFile.SaveAs("C:\ivan\privados\archivos \" & Fname) '// ruta absoluta
Return True
Else
Return False
End If
End Function
' para la extension tengo esto,aunq hasta ahora no he probao con imagenes:
Function CheckFile() As Boolean
If file1.PostedFile.ContentLength > 0 Then
If Not (file1.PostedFile.ContentLength / 1000) > 1024 Then
Dim FileExt As String
FileExt = System.IO.Path.GetExtension(file1.PostedFile.FileN ame).ToLower
If FileExt = ".doc" Or FileExt = ".txt" Or FileExt = ".pdf" Then
lblerror.Text = "El fichero a sido enviado!!!"
Return True
Else
lblerror.Text = "La extensión del fixhero no es corecta."
Return False
End If
Else
Dim SizeMBs As String
SizeMBs = CStr(file1.PostedFile.ContentLength / (1024 * 1024))
SizeMBs = SizeMBs.Substring(0, SizeMBs.IndexOf(".") + 3)
lblerror.Text = "El fichero es demasiado grande ! tu pudes enviar ficheros de 1 Mb como maximo, y el fichero actual tine un tamaño de " & SizeMBs & "MB"
Return False
End If
Else
lblerror.Text = "Fichero no Valido"
return False
End If
End Function |