Subida de Ficheros
Messages   Related Types
This message was discovered on ASPFriends.com 'aspnges' list.


Laura San Roman
=A1Hola!

    Estamos desarrollando una aplicaci=F3n piloto en .NET en la cual
necesitamos subir ficheros e imagenes al servidor desde las p=E1ginas =
.aspx.
No logro encontrar documentaci=F3n al respecto. =BFAlgui=E9n me =
podr=EDa indicar por
favor como hacerlo?

Reply to this message...
 
    
Adrian Garcia
Laura,
Aqui tienes un ejemplo. Si querias hacer esto desde ASP significaban unas
cuantas lineas de codigo, ahora utilizando un control del tipo HTMLInputFile
se resuelve de forma muy sencilla:

<html>
<head>

<script language="VB" runat="server">
Sub Button1_Click(Source As Object, e As EventArgs)

If Text1.Value = "" Then
Span1.InnerHtml = "Error: Debe ingresar el nombre"
Return
End If

If Not (File1.PostedFile Is Nothing) Then
Try
File1.PostedFile.SaveAs(("c:\temp\" + Text1.Value))
Span1.InnerHtml = "Archivo salvado en <b>c:\\temp\\" & _
Text1.Value & "</b> en el servidor"
Catch exc As Exception
Span1.InnerHtml = "Error salvando el archivo <b>c:\\temp\\"
& _
Text1.Value & "</b><br>" &
exc.ToString()
End Try
End If
End Sub 'Button1_Click

</script>

</head>
<body>

<h3><font face="Verdana">HtmlInputFile Sample</font></h3>

<form enctype="multipart/form-data" runat="server">

Seleccione el archivo a levantar:
<input id="File1"
type="file"
maxlength="30"
runat="server"/>

<p>
Salvar como (sin el path):
<input id="Text1"
type="text"
runat="server"/>

<p>
<span id="Span1"
style="font: 8pt verdana;"
runat="server" />

<p>
<input type="button"
id="Button1"
value="Levantar"
OnServerClick="Button1_Click"
runat="server">

</form>

</body>
</html>

Saludos

Adrian Garcia
Microsoft MVP [C#/ASP] - MCSD
NDSoft Filial Córdoba - Argentina
Click here to reveal e-mail address

----Original Message Follows----
From: Laura San Roman <Click here to reveal e-mail address>
Reply-To: "aspnges" <Click here to reveal e-mail address>
To: "aspnges" <Click here to reveal e-mail address>
Subject: [aspnges] Subida de Ficheros
Date: Thu, 23 Aug 2001 11:08:51 +0100

¡Hola!

    Estamos desarrollando una aplicación piloto en .NET en la cual
necesitamos subir ficheros e imagenes al servidor desde las páginas .aspx.
No logro encontrar documentación al respecto. ¿Alguién me podría indicar por
favor como hacerlo?

| [aspnges] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspnges.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

_________________________________________________________________
Descargue GRATUITAMENTE MSN Explorer en http://explorer.msn.es/intl.asp

Reply to this message...
 
    
Rojas, Jose (XCOL)
disculpen... este control"HTMLInputFile" donde lo encuentro... es de asp o
de .Net..
Gracias

_____

Jose Julian Rojas Ram&#ED;rez
Xerox de Colombia S.A
Departamento de Sistemas
Click here to reveal e-mail address <mailto:Click here to reveal e-mail address>
4160055- ext 2279

-----Original Message-----
From: Adrian Garcia [mailto:Click here to reveal e-mail address]
Sent: Jueves 23 de Agosto de 2001 10:26 AM
To: aspnges
Subject: [aspnges] Re: Subida de Ficheros

Laura,
Aqui tienes un ejemplo. Si querias hacer esto desde ASP significaban unas
cuantas lineas de codigo, ahora utilizando un control del tipo HTMLInputFile

se resuelve de forma muy sencilla:

<html>
<head>

<script language="VB" runat="server">
Sub Button1_Click(Source As Object, e As EventArgs)

If Text1.Value = "" Then
Span1.InnerHtml = "Error: Debe ingresar el nombre"
Return
End If

If Not (File1.PostedFile Is Nothing) Then
Try
File1.PostedFile.SaveAs(("c:\temp\" + Text1.Value))
Span1.InnerHtml = "Archivo salvado en <b>c:\\temp\\" & _
Text1.Value & "</b> en el servidor"
Catch exc As Exception
Span1.InnerHtml = "Error salvando el archivo <b>c:\\temp\\"
& _
Text1.Value & "</b><br>" &
exc.ToString()
End Try
End If
End Sub 'Button1_Click

</script>

</head>
<body>

<h3><font face="Verdana">HtmlInputFile Sample</font></h3>

<form enctype="multipart/form-data" runat="server">

Seleccione el archivo a levantar:
<input id="File1"
type="file"
maxlength="30"
runat="server"/>

<p>
Salvar como (sin el path):
<input id="Text1"
type="text"
runat="server"/>

<p>
<span id="Span1"
style="font: 8pt verdana;"
runat="server" />

<p>
<input type="button"
id="Button1"
value="Levantar"
OnServerClick="Button1_Click"
runat="server">

</form>

</body>
</html>

Saludos

Adrian Garcia
Microsoft MVP [C#/ASP] - MCSD
NDSoft Filial C&#F3;rdoba - Argentina
Click here to reveal e-mail address

----Original Message Follows----
From: Laura San Roman <Click here to reveal e-mail address>
Reply-To: "aspnges" <Click here to reveal e-mail address>
To: "aspnges" <Click here to reveal e-mail address>
Subject: [aspnges] Subida de Ficheros
Date: Thu, 23 Aug 2001 11:08:51 +0100

&#A1;Hola!

    Estamos desarrollando una aplicaci&#F3;n piloto en .NET en la cual
necesitamos subir ficheros e imagenes al servidor desde las p&#E1;ginas .aspx.
No logro encontrar documentaci&#F3;n al respecto. &#BF;Algui&#E9;n me podr&#ED;a indicar por
favor como hacerlo?

| [aspnges] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspnges.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

_________________________________________________________________
Descargue GRATUITAMENTE MSN Explorer en http://explorer.msn.es/intl.asp

| [aspnges] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspnges.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

____________________________________________________________________________
__________
The information transmitted herein is intended only for the person or entity
to which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from any
computer.
Reply to this message...
 
    
Laura San Roman
Muchas gracias por la ayuda.
Un saludo.

-----Original Message-----
From: Adrian Garcia [mailto:Click here to reveal e-mail address]
Sent: jueves, 23 de agosto de 2001 17:26
To: aspnges
Subject: [aspnges] Re: Subida de Ficheros

Laura,
Aqui tienes un ejemplo. Si querias hacer esto desde ASP significaban =
unas=20
cuantas lineas de codigo, ahora utilizando un control del tipo =
HTMLInputFile

se resuelve de forma muy sencilla:

<html>
<head>

<script language=3D"VB" runat=3D"server">
Sub Button1_Click(Source As Object, e As EventArgs)

If Text1.Value =3D "" Then
Span1.InnerHtml =3D "Error: Debe ingresar el nombre"
Return
End If

If Not (File1.PostedFile Is Nothing) Then
Try
File1.PostedFile.SaveAs(("c:\temp\" + Text1.Value))
Span1.InnerHtml =3D "Archivo salvado en <b>c:\\temp\\" =
& _
Text1.Value & "</b> en el =
servidor"
Catch exc As Exception
Span1.InnerHtml =3D "Error salvando el archivo =
<b>c:\\temp\\"=20
& _
Text1.Value & "</b><br>" &=20
exc.ToString()
End Try
End If
End Sub 'Button1_Click

</script>

</head>
<body>

<h3><font face=3D"Verdana">HtmlInputFile Sample</font></h3>

<form enctype=3D"multipart/form-data" runat=3D"server">

Seleccione el archivo a levantar:
<input id=3D"File1"
type=3D"file"
maxlength=3D"30"
runat=3D"server"/>

<p>
Salvar como (sin el path):
<input id=3D"Text1"
type=3D"text"
runat=3D"server"/>

<p>
<span id=3D"Span1"
style=3D"font: 8pt verdana;"
runat=3D"server" />

<p>
<input type=3D"button"
id=3D"Button1"
value=3D"Levantar"
OnServerClick=3D"Button1_Click"
runat=3D"server">

</form>

</body>
</html>

Saludos

Adrian Garcia
Microsoft MVP [C#/ASP] - MCSD
NDSoft Filial C=F3rdoba - Argentina
Click here to reveal e-mail address

----Original Message Follows----
From: Laura San Roman <Click here to reveal e-mail address>
Reply-To: "aspnges" <Click here to reveal e-mail address>
To: "aspnges" <Click here to reveal e-mail address>
Subject: [aspnges] Subida de Ficheros
Date: Thu, 23 Aug 2001 11:08:51 +0100

=A1Hola!

    Estamos desarrollando una aplicaci=F3n piloto en .NET en la cual
necesitamos subir ficheros e imagenes al servidor desde las p=E1ginas =
.aspx.
No logro encontrar documentaci=F3n al respecto. =BFAlgui=E9n me =
podr=EDa indicar por
favor como hacerlo?

| [aspnges] member Click here to reveal e-mail address =3D YOUR ID
| http://www.asplists.com/asplists/aspnges.asp =3D JOIN/QUIT
| http://www.asplists.com/search =3D SEARCH Archives

_________________________________________________________________
Descargue GRATUITAMENTE MSN Explorer en http://explorer.msn.es/intl.asp

| [aspnges] member Click here to reveal e-mail address =3D YOUR ID
| http://www.asplists.com/asplists/aspnges.asp =3D JOIN/QUIT
| http://www.asplists.com/search =3D SEARCH Archives

Reply to this message...
 
    
Adrian Garcia
Es un control de ASP.NET, que se ejecuta del lado del servidor y que:
1) Genera el HTML necesario para armar un control HTML Input File
2) A la vuelta (en el postback) permite un acceso simple al contenido del
archivo enviado, nada que ver con ASP tradicional!

Saludos

Adrian Garcia
Microsoft MVP [C#/ASP] - MCSD
NDSoft Filial Córdoba - Argentina
Click here to reveal e-mail address

----Original Message Follows----
From: "Rojas, Jose (XCOL)" <Click here to reveal e-mail address>
Reply-To: "aspnges" <Click here to reveal e-mail address>
To: "aspnges" <Click here to reveal e-mail address>
Subject: [aspnges] Re: Subida de Ficheros
Date: Thu, 23 Aug 2001 11:31:18 -0500

disculpen... este control"HTMLInputFile" donde lo encuentro... es de asp o
de .Net..
Gracias

_____

Jose Julian Rojas Ramírez
Xerox de Colombia S.A
Departamento de Sistemas
Click here to reveal e-mail address <mailto:Click here to reveal e-mail address>
4160055- ext 2279

-----Original Message-----
From: Adrian Garcia [mailto:Click here to reveal e-mail address]
Sent: Jueves 23 de Agosto de 2001 10:26 AM
To: aspnges
Subject: [aspnges] Re: Subida de Ficheros

Laura,
Aqui tienes un ejemplo. Si querias hacer esto desde ASP significaban unas
cuantas lineas de codigo, ahora utilizando un control del tipo HTMLInputFile

se resuelve de forma muy sencilla:

<html>
<head>

<script language="VB" runat="server">
Sub Button1_Click(Source As Object, e As EventArgs)

If Text1.Value = "" Then
Span1.InnerHtml = "Error: Debe ingresar el nombre"
Return
End If

If Not (File1.PostedFile Is Nothing) Then
Try
File1.PostedFile.SaveAs(("c:\temp\" + Text1.Value))
Span1.InnerHtml = "Archivo salvado en <b>c:\\temp\\" & _
Text1.Value & "</b> en el servidor"
Catch exc As Exception
Span1.InnerHtml = "Error salvando el archivo <b>c:\\temp\\"
& _
Text1.Value & "</b><br>" &
exc.ToString()
End Try
End If
End Sub 'Button1_Click

</script>

</head>
<body>

<h3><font face="Verdana">HtmlInputFile Sample</font></h3>

<form enctype="multipart/form-data" runat="server">

Seleccione el archivo a levantar:
<input id="File1"
type="file"
maxlength="30"
runat="server"/>

<p>
Salvar como (sin el path):
<input id="Text1"
type="text"
runat="server"/>

<p>
<span id="Span1"
style="font: 8pt verdana;"
runat="server" />

<p>
<input type="button"
id="Button1"
value="Levantar"
OnServerClick="Button1_Click"
runat="server">

</form>

</body>
</html>

Saludos

Adrian Garcia
Microsoft MVP [C#/ASP] - MCSD
NDSoft Filial Córdoba - Argentina
Click here to reveal e-mail address

----Original Message Follows----
From: Laura San Roman <Click here to reveal e-mail address>
Reply-To: "aspnges" <Click here to reveal e-mail address>
To: "aspnges" <Click here to reveal e-mail address>
Subject: [aspnges] Subida de Ficheros
Date: Thu, 23 Aug 2001 11:08:51 +0100

¡Hola!

    Estamos desarrollando una aplicación piloto en .NET en la cual
necesitamos subir ficheros e imagenes al servidor desde las páginas .aspx.
No logro encontrar documentación al respecto. ¿Alguién me podría indicar por
favor como hacerlo?

| [aspnges] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspnges.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

_________________________________________________________________
Descargue GRATUITAMENTE MSN Explorer en http://explorer.msn.es/intl.asp

| [aspnges] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspnges.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

____________________________________________________________________________
__________
The information transmitted herein is intended only for the person or entity
to which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from any
computer.

| [aspnges] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspnges.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

_________________________________________________________________
Descargue GRATUITAMENTE MSN Explorer en http://explorer.msn.es/intl.asp

Reply to this message...
 
 
System.EventArgs
System.Web.UI.HtmlControls.HtmlInputFile




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com