Quantcast
Channel: Fórum ASP
Viewing all articles
Browse latest Browse all 1214

Upload de arquivos

$
0
0

Boa Tarde Amigos,

Peguei um exemplo de upload, código:

Porém quando faço o upload, o arquivo não sobe para a hospedagem ..

 

<HTML>
<HEAD>
<TITLE>AspUpload Live Demo 1: Simple Uploads</TITLE>
</HEAD>
<BODY>
 
<FONT FACE="Arial" size="2">
 
<H4>Simple Uploads</h4>
 
<B>Select 1, 2 or 3 files, then click the Upload button. Images (.gif, .jpg, .png)
will be automatically displayed.</B>
<P>
 
<FORM NAME="MyForm" METHOD="POST" ENCTYPE="multipart/form-data" 
ACTION="upload1.asp"> 
<TABLE CELLSPACING=0 CELLPADDING=3 BORDER=1>
<TD BGCOLOR="#FFFFCC">
<INPUT TYPE=FILE SIZE=40 NAME="FILE1"><BR>
<INPUT TYPE=FILE SIZE=40 NAME="FILE2"><BR>
<INPUT TYPE=FILE SIZE=40 NAME="FILE3"><BR>
<INPUT TYPE=SUBMIT VALUE="Upload">
 
</TD>
</TABLE>
</FORM>
 
<P>
 
<A HREF="demo1.zip">Download source code for this demo</A>
 
</FONT>
</BODY>
</HTML>
 
 

 
<%
Set Upload = Server.CreateObject("Persits.Upload.1")
 
Upload.OverwriteFiles = False
On Error Resume Next
 
Upload.SetMaxSize 1048576 ' Limit files to 1MB
Count = Upload.Save("c:\upload")
%>
<HTML>
<BODY BGCOLOR="#FFFFFF">
<CENTER>
 
<% If Err <> 0 Then %>
 
<FONT SIZE=3 FACE="Arial" COLOR=#0020A0>
<H3>The following error occured while uploading:</h3>
</FONT>
 
<FONT SIZE=3 FACE="Arial" COLOR=#FF2020>
<h2>"<% = Err.Description %>"</h2>
</FONT>
 
<FONT SIZE=2 FACE="Arial" COLOR="#0020A0">
Please <A HREF="demo1.asp">try again</A>.
</FONT>
 
<% Else %>
<FONT SIZE=3 FACE="Arial" COLOR=#0020A0>
<h2>Success! <% = Count %> file(s) have been uploaded.</h2>
</FONT>
 
<FONT SIZE=3 FACE="Arial" COLOR=#0020A0>
<TABLE BORDER=1 CELLPADDING=3 CELLSPACING=0>
<TH BGCOLOR="#FFFF00">Uploaded File</TH><TH BGCOLOR="#FFFF00">Size</TH><TH BGCOLOR="#FFFF00">Original Size</TH><TR>
<% For Each File in Upload.Files %>
<% If File.ImageType = "GIF" or File.ImageType = "JPG" or File.ImageType = "PNG" Then %>
<TD ALIGN=CENTER>
<IMG SRC="/uploaddir/<% = File.FileName%>"><BR><B><% = File.OriginalPath%></B><BR>
(<% = File.ImageWidth %> x <% = File.ImageHeight %> pixels)
 
</TD>
<% Else %>
<TD><B><% = File.OriginalPath %></B></TD>
<% End If %>
<TD ALIGN=RIGHT VALIGN="TOP"><% =File.Size %> bytes</TD>
<TD ALIGN=RIGHT VALIGN="TOP"><% =File.OriginalSize %> bytes</TD><TR>
<% Next %>
</TABLE>
</FONT>
<P>
<FONT SIZE=2 FACE="Arial" COLOR=#0020A0>
Click <A HREF="demo1.asp">here</A> to upload more files.
</FONT>
<% End If %>
 
<HR>
<FONT SIZE=2 FACE="Arial" COLOR=#0020A0>
<A HREF="http://www.persits.com/aspupload.exe">Download</A> your trial copy of AspUpload.
</FONT>
 
 
 
</CENTER>
</BODY>
</HTML>
 

Viewing all articles
Browse latest Browse all 1214