Ver Mensaje Individual
  #4 (permalink)  
Antiguo 24/05/2004, 07:54
Avatar de lucxx
lucxx
 
Fecha de Ingreso: noviembre-2003
Ubicación: Madrid
Mensajes: 321
Antigüedad: 21 años, 3 meses
Puntos: 0
Hola
En asp.net no es necesario ningun componente para subir archivos al server. Aqui un ejemplo sacado de microsoft:

archivo.aspx:
Código:
<form id="Form1" enctype="multipart/form-data"   runat="server">

<INPUT type=file id=File1 name=File1 runat="server" >
<br>
<input type="submit" id="Submit1" value="Upload" runat="server" NAME="Submit1">


    </form>



archivo.vb:

Código:
Private Sub Submit1_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Submit1.ServerClick

        If Not File1.PostedFile Is Nothing And File1.PostedFile.ContentLength > 0 Then
            Dim fn As String = System.IO.Path.GetFileName(File1.PostedFile.FileName)
            Dim SaveLocation as String = Server.MapPath("Data") & "\" & fn
            Try
                File1.PostedFile.SaveAs(SaveLocation)
                Response.Write("The file has been uploaded.")
            Catch Exc As Exception
                Response.Write("Error: " & Exc.Message)
            End Try
        Else
            Response.Write("Please select a file to upload.")
        End If

    End Sub
Teniendo en cuenta que debes tener permiso de escritura en la carpeta a la que vas a subir el archivo.


Y como apunte, puedes modificar ciertos parámetros en el web.config:

Código:
<httpRuntime 
executionTimeout="90" 
maxRequestLength="4096"
useFullyQualifiedRedirectUrl="false" 
minFreeThreads="8" 
minLocalRequestFreeThreads="4"
appRequestQueueLimit="100"
/>
donde maxRequestLength="4096" es el tamaño máximo de archivo a subir (por defecto 4096KB)

Salu2