Forums

ASP

This topic is locked

Need Help with a Linking issue

Posted 16 Dec 2002 09:40:20
1
has voted
16 Dec 2002 09:40:20 Tom Chase posted:
I have created a site which I have users upload files to a directory called"uploads" when the user log in they are presented with a page of the files they have uploaded... I want these files to be links so if they uploaded something called - printjob.zip they will be prompted to download it - For the life of me I can't figure this out.... Can I get some help on how to make this work

Tom

Replies

Replied 16 Dec 2002 10:46:35
16 Dec 2002 10:46:35 Martha Graham replied:
Replied 16 Dec 2002 19:36:11
16 Dec 2002 19:36:11 Tom Chase replied:
Ok this is really frigging pissing me off - I followed the FAQ and I end up at a page that passes this link.... 192.168.1.157/impact/uploads/download.asp?file_name=3DStudioMax4Keygen.exe and it opens a blank page... does que for download or anything... here is the code from the page where the links are displayed:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/impact_dsn_vb.asp" -->
<% Session("user" = Request.Form("Username" %>
<%
Dim Recordset1__var_user
Recordset1__var_user = "%"
if (Session("user" <> "" then Recordset1__var_user = Session("user"
%>
<%
set Recordset1 = Server.CreateObject("ADODB.Recordset"
Recordset1.ActiveConnection = MM_impact_dsn_vb_STRING
Recordset1.Source = "SELECT * FROM login_info WHERE Username = '" + Replace(Recordset1__var_user, "'", "''" + "'"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
Dim uploads__MMColParam
uploads__MMColParam = "1"
If (Session("user" <> "" Then
uploads__MMColParam = Session("user"
End If
%>
<%
Dim uploads
Dim uploads_numRows

Set uploads = Server.CreateObject("ADODB.Recordset"
uploads.ActiveConnection = MM_impact_dsn_vb_STRING
uploads.Source = "SELECT * FROM upload WHERE client_name = '" + Replace(uploads__MMColParam, "'", "''" + "'"
uploads.CursorType = 0
uploads.CursorLocation = 2
uploads.LockType = 1
uploads.Open()

uploads_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
uploads_numRows = uploads_numRows + Repeat1__numRows
%>
<%
Dim MM_paramName
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth

Dim MM_removeList
Dim MM_item
Dim MM_nextItem

' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "" Then
MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If

MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""

' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
End If
Next

' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
End If
Next

' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "" Then
MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "" Then
MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "" Then
MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> "" Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="89%" border="0">

<tr>
<td width="14%"> </td>
<td colspan="3"><img src="images/impact_logo_art.gif" alt="Imapct Printing & Graphics Inc." width="259" height="76"></td>
</tr>
<tr>
<td rowspan="5" bgcolor="#666699"> </td>
<td width="5%" rowspan="2"> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2">Welcome <%=(Recordset1.Fields.Item("company_name".Value)%>to the Impact Printing and Graphic's Client upload site. From
this page you will be able to upload new files and submit job requests to
Impact Printing. You will also be able to view uploaded files that Impact
Printing has prepared for you.</td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td> </td>
<td width="56%"> Files Upload by <%=(Recordset1.Fields.Item("company_name".Value)%></td>
<td width="25%"><a href="upload.asp">Click here to upload a new file</a></td>
</tr>
<tr>
<td> </td>
<td>
<% If uploads.EOF And uploads.BOF Then %>
<p>Sorr you have nothing uploaded</p>
<% End If ' end uploads.EOF And uploads.BOF %>
<table width="102%" border="0">
<% If Not uploads.EOF Or Not uploads.BOF Then %>
<%
While ((Repeat1__numRows <> 0) AND (NOT uploads.EOF))
%>
<tr>
<td width="58%"><A HREF="uploads/download.asp?<%= MM_keepURL & MM_joinChar(MM_keepURL) & "file_name=" & uploads.Fields.Item("file_name".Value %>"><%=(uploads.Fields.Item("file_name".Value)%></A></td>
<td width="42%"><font size="2"><%=(uploads.Fields.Item("date_current".Value)%></font></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
uploads.MoveNext()
Wend
%>
<% End If ' end Not uploads.EOF Or NOT uploads.BOF %>
</table></td>
<td> </td>
</tr>
</table>

</body>
</html>
<%
Recordset1.Close()
%>
<%
uploads.Close()
Set uploads = Nothing
%>


Reply to this topic