Using ASP to perform multiple file uploads to IIS 6.0 Web Site

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

rebel69

Thread Starter
Joined
Jun 28, 2005
Messages
3
I just downloaded some freeware code to allow me to add a web page to a site in order to give certain users the ability to upload files to a web site that I administer for them. The site is for a non-profit and is hosted on my home network The code was downloaded from BOLTWARE and is attached and listed below (.asp and .inc files). Since I have no experience with ASP programming, I'm at a loss as to how to troubleshoot the error 500 that the browser is thowing when I attempt to view the page in the browser.
The sample code provided by the vendor was installed pretty much as they suggest, with the exception that I placed the asp and inc files in a secured (NTFS and SSL) folder one level below the root of the site:

\Members_ONLY - secured folder
\Members_ONLY\uploads - base upload folder
\Members_ONLY\uploads\temp - scratch folder
\Members_ONLY\uploads\data - file upload destination folder

I think the problem could be related to how to set the code to point to the correct folders. I removed the extraneous code for writing to a database since it's not needed at this point.

All the folders under \Members_ONLY have their NTFS permissions set fairly liberally until this issue is resolved; then they will be locked down further.

O/S: W2K3 Standard w/SP1 and fully patched.
Server Hardware: Intel Motherboard, 1GB RAM, 10/100 integrated NIC, Adaptec 3400S 4-channel RAID w/26 drives in 3 RAID 5 arrays using various drive sizes - 9.1GB, 18.2GB and 36.4GB, Adaptec 2410SA cabinet w/4 190GB SATA drives in RAID 5 array used for virtual tape backup. Standard floppy, CDRW drive, Serial/Parallel and USB ports, 4 Compaq Proliant Storage System U/1 towers. Most hardware except m-board and SATA RAID cabinet salvaged from the "graveyard" at work.
I'm an ASP novice and plan on learning more about ASP programming...the last real programming I did was in '86 assembler back in the 1980's and it came easy since I was working in a hardware development lab and understood things at the machine code level.

Any help geting this to work would be greatly appreciated, since I made a commitment (mostly to keep me from getting e-mails with attachments to place into the site) to get this app up and running by the weekend (shoulda' known better...) ;) .

Thanks,
Jon

Example Code:

file_server.asp:

<!-- #include file="file_upload.inc" --><%

Dim Form, FSO, File

Set Form = Server.CreateObject("cASPer.FileUpload")
Form.ProcessRequest DataPath, False
Set FSO = Server.CreateObject("Scripting.FileSystemObject")


Select Case Form("Op")

'----------------------------------------------------------------
Case "Delete" 'Default action: list all files and display form
FSO.DeleteFile DataPath & "\" & Form("File")

End Select


%><H1>Upload a File</H1>

<FORM METHOD="POST" ENCTYPE="multipart/form-data"
ACTION="file_server.asp">
<INPUT TYPE="FILE" NAME="File_1">
<INPUT TYPE="SUBMIT" VALUE="Upload">
</FORM>

<H1>File List:</H1>
<TABLE BORDER="1">
<TR><TH>Action</TH><TH>Filename</TH></TR>
<%
For Each File In FSO.GetFolder(DataPath).Files

%> <TR><TD><A HREF="file_server.asp?Op=Delete&File=<%
Write Server.URLEncode(File.Name)
%>">Delete</A></TD><TD><A HREF="data/<%
Write File.Name
%>"><%= ToHtml(File.Name) %></A></TD></TR>
<%
Next

%></TABLE>

<P><B>About this Component:</B>
<BR><%= ToHtml(Form.About) %>

****************************

file_upload.inc:

<%

Option Explicit


Dim TempPath, DataPath, DbConnection

'We'll be storing data in the "data" subfolder of the folder
'our sample programs are in; likewise for "temp"
DataPath = Split(Request.ServerVariables("PATH_TRANSLATED"), "\")
ReDim Preserve DataPath(UBound(DataPath) - 1)
TempPath = Join(DataPath, "\") & "\temp"
DataPath = Join(DataPath, "\") & "\data"

Set DbConnection = Server.CreateObject("ADODB.Connection")
DbConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & DataPath & "\..\Sample.mdb"
DbConnection.Open


'Shorthand for Response.Write
Function Write(Text)
Response.Write Text
End Function


'Convert the text into an HTML-friendly version
Function ToHtml(ByVal Text)
Dim Pos
Text = "" & Text
Text = Replace(Text, "&", "&amp;")
Text = Replace(Text, ">", "&gt;")
Text = Replace(Text, "<", "&lt;")
Text = Replace(Text, """", "&quot;")
Text = Replace(Text, vbCrLf, vbCrLf & "<BR>")
ToHtml = Text
End Function


'Open a recordset
Function OpenWriteRecordset(Sql)
Set OpenWriteRecordset = Server.CreateObject("ADODB.Recordset")
OpenWriteRecordset.CursorType = 2
OpenWriteRecordset.CursorLocation = 2
OpenWriteRecordset.LockType = 3
OpenWriteRecordset.Open Sql, DbConnection
End Function

%>
 
Joined
Jul 29, 2001
Messages
21,334
What error messages are you getting? From the sound of it you put the asp and include files in a different location than the root which is where they are being called from.
 

rebel69

Thread Starter
Joined
Jun 28, 2005
Messages
3
I was trying to place the asp and include files out of the root and changed the code to reflect that (or so I thought). I moved them to the root and placed the data and temp folders out of the root as well. Now I'm able to upload single files, but when I upload a large file (~56MB, IE throws back an HTTP 500 error), although the large file does indeed upload successfully.

So, I'm making progress, but would like the give the user the ability to upload multiple files in one shot instead of doing a single upload, also I'd like to remove the "delete" option from the file list table.

I'll try to attach the modified code if the TSG site will allow me...

Thanks and have a great 4th!
Jon
 

Attachments

Joined
Jul 29, 2001
Messages
21,334
I think a 56MB file will time out your local session. You can extend the session timout in the IIS settings for the web site. 56MB file uploads are kind of extreme aren't they?

Uploading multiple files is a function of the component you are using and if it doesn't support it you have no choice but doing it one file at a time.
 

rebel69

Thread Starter
Joined
Jun 28, 2005
Messages
3
Just got back from a weekend camping and checked the Boltware web site. They have some additional sample code called file_attachments.asp. I'll try it and see if it does what I want. From jus tscanning the code, it looks as though it will upload an entire folder instead of a single file. Not knowing how FSO works, I'll just test it and see what happens. And yes, 56 MB is extreme, but I like to push limits just for grins. ;)

Attached uncustomized "file_attachments" code.
 

Attachments

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top