Monografias

Solo disponible en BuenasTareas
  • Páginas : 3 (740 palabras )
  • Descarga(s) : 0
  • Publicado : 11 de junio de 2011
Leer documento completo
Vista previa del texto
http://msdn.microsoft.com/es-es/library/aa479405.aspx
Protected Sub UploadButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim savePath As String = "c:\temp\uploads"
If(FileUpload1.HasFile) Then
Dim fileSize As Integer = FileUpload1.PostedFile.ContentLengthIf (fileSize < 2100000) Then
savePath += Server.HtmlEncode(FileUpload1.FileName)
FileUpload1.SaveAs(savePath)UploadStatusLabel.Text = "Your file was uploaded successfully."
Else
UploadStatusLabel.Text = "Your file was not uploaded because " + _
"it exceeds the 2 MB size limit."
End If

Iffile_Adjuntar.PostedFile.ContentLength > 3145728 Then Return "E-El archivo tiene un tamaño superior a los 3MB.(" + _
file_Adjuntar.PostedFile.ContentLength & ")"

o
con el y con ambas me saca cuando elarchivo es muy grande.

Visual Basic
Protected Sub Button1_Click(ByVal sender As Object, _
ByVal e As System.EventArgs)
IfFileUpload1.HasFile Then
Dim fileExt As String
fileExt = System.IO.Path.GetExtension(FileUpload1.FileName)If (fileExt = ".mp3") Then
Try
FileUpload1.SaveAs("C:\Uploads" & _FileUpload1.FileName)
Label1.Text = "File name: " & _
FileUpload1.PostedFile.FileName & "" & _"File Size: " & _
FileUpload1.PostedFile.ContentLength & " kb" & _
"Content type: " & _FileUpload1.PostedFile.ContentType
Catch ex As Exception
Label1.Text = "ERROR: " & ex.Message.ToString()...
tracking img