Problem upload image with ASP

Status
Not open for further replies.

Discusman

In Runtime
Messages
220
I'm pasting the code here, so plz test the code on ur server if u can. A very simple file upload program, it doesn't work on my server, but it works on other ppl's server

File name: Upload2New.asp
=====================
<%
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:\Inetpub\wwwroot\gallery")
%>
<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 try again.
</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>
<TD>Image:</TD>
<% If Count > 0 Then %>
<%
Set File = Upload.Files(1)
If File.ImageType = "GIF" or File.ImageType = "JPG" or File.ImageType = "PNG" Then %>
<TD ALIGN=CENTER>/uploaddir/<% = File.FileName%>
<% = File.OriginalPath%>

(<% = File.ImageWidth %> x <% = File.ImageHeight %> pixels)
</TD>
<% Else %>
<TD><% = File.OriginalPath %></TD>
<% End If %>
<% Else %>
<TD>File not selected.</TD>
<% End If %>
<TR>
<TD>Description:</TD><TD><% = Upload.Form("Description") %></TD><TR>
<TD>Categories:</TD>
<TD>
<%
For Each Item in Upload.Form
If Item.Name = "Category" Then Response.Write Item.Value & "
"
Next
%>
</TD>
</TABLE>


</FONT>



<FONT SIZE=2 FACE="Arial" COLOR=#0020A0>
Click here to upload more files.
</FONT>
<% End If %>

<HR>
<FONT SIZE=2 FACE="Arial" COLOR=#0020A0>
Download your trial copy of AspUpload.



Back to AspUpload.com.
</FONT>



</CENTER>
</BODY>
</HTML>
=================================
Here is the upload form:
File name:
=================================
<HTML>
<HEAD>
<TITLE>AspUpload Live Demo 2: Uploads of Files and Form Items</TITLE>
</HEAD>
<BODY>

<FONT FACE="Arial" size="2">

<H4>Uploads of Files and Form Items</h4>

Select a file, enter a description and select one or more categories.




<FORM METHOD="POST" ENCTYPE="multipart/form-data"
ACTION="upload2new.asp">
<TABLE CELLSPACING=0 CELLPADDING=3 BORDER=1>
<TD BGCOLOR="#FFFFCC">File:</TD>
<TD BGCOLOR="#FFFFCC"><INPUT TYPE=FILE SIZE=30 NAME="THEFILE"></TD><TR>
<TD BGCOLOR="#FFFFCC">Description:</TD>
<TD BGCOLOR="#FFFFCC"><INPUT TYPE=TEXT SIZE=30 NAME="Description"></TD><TR>
<TD BGCOLOR="#FFFFCC" VALIGN="TOP">Categories:</TD>
<TD BGCOLOR="#FFFFCC" VALIGN="TOP">
<SELECT NAME="Category" MULTIPLE>
<OPTION>Image
<OPTION>Text
<OPTION>Source Code
<OPTION>Archive
</SELECT>
</TD><TR>
<TD COLSPAN=2 BGCOLOR="#FFFFCC"><INPUT TYPE=SUBMIT VALUE="Upload"></TD>

</TD>
</TABLE>
</FORM>





Download source code for this demo

</FONT>
</BODY>
</HTML>
====================================
I get this error after I clicked upload button:
=======================
The page cannot be displayed
There is a problem with the page you are trying to reach and it cannot be displayed.

--------------------------------------------------------------------------------

Please try the following:

Open the www.nyc-discusfanatics.com home page, and then look for links to the information you want.
Click the Refresh button, or try again later.

Click Search to look for information on the Internet.
You can also see a list of related sites.




HTTP 500 - Internal server error
Internet Explorer
=============================
 
you need to use the
PHP:
[PHP]
[/PHP] tags so we can see your code or attach a text document to your post. i see garbage.
 
Status
Not open for further replies.
Back
Top Bottom