Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP General (http://www.velocityreviews.com/forums/f65-asp-general.html)
-   -   Disguise URL of downloadable file (http://www.velocityreviews.com/forums/t796007-disguise-url-of-downloadable-file.html)

JJ 08-23-2004 12:57 PM

Disguise URL of downloadable file
 
Hi,
I am writing a cart in ASP selling downloadable files.
The files are stored on remote locations i.e.
http://www.thisfilestore.com/file1.zip

And have different extensions, i.e. they are not all zip files.
I would like to write a script which cann be called which will allow the
download of the file, without giving away the url.

Any Ideas/examples welcome!
Thanks in Advance
JJ



Steven Burn 08-23-2004 01:07 PM

Re: Disguise URL of downloadable file
 
#1. Place them OUTSIDE of the web root
#2. Place them OUTSIDE of the web root
#3. Place them OUTSIDE of the web root

Once outside of the web root, they cannot be downloaded directly and thus,
you could simply just call the file whenever you <whatever it is your
wanting to do>

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!


"JJ" <nospam> wrote in message
news:4129ea1d$0$29945$cc9e4d1f@news.dial.pipex.com ...
> Hi,
> I am writing a cart in ASP selling downloadable files.
> The files are stored on remote locations i.e.
> http://www.thisfilestore.com/file1.zip
>
> And have different extensions, i.e. they are not all zip files.
> I would like to write a script which cann be called which will allow the
> download of the file, without giving away the url.
>
> Any Ideas/examples welcome!
> Thanks in Advance
> JJ
>
>




Tom Kaminski [MVP] 08-23-2004 01:08 PM

Re: Disguise URL of downloadable file
 
"JJ" <nospam> wrote in message
news:4129ea1d$0$29945$cc9e4d1f@news.dial.pipex.com ...
> Hi,
> I am writing a cart in ASP selling downloadable files.
> The files are stored on remote locations i.e.
> http://www.thisfilestore.com/file1.zip
>
> And have different extensions, i.e. they are not all zip files.
> I would like to write a script which cann be called which will allow the
> download of the file, without giving away the url.
>
> Any Ideas/examples welcome!


Store the files outside of the web root path (so they don't actually have a
URL) and use ADODB.Stream and Response.BinaryWrite to send them to the
client.

http://www.aspfaq.com/show.asp?id=2161
http://support.microsoft.com/?kbid=276488

--
Tom Kaminski IIS MVP
http://www.microsoft.com/windowsserv...y/centers/iis/
http://mvp.support.microsoft.com/
http://www.iisfaq.com/
http://www.iistoolshed.com/ - tools, scripts, and utilities for running IIS
http://www.tryiis.com



Stuart Palmer 08-23-2004 01:11 PM

Re: Disguise URL of downloadable file
 
You need to create a page that processes the download. The path to the file
can be anywhere but you just give the querystring param just the file name
(or ID number) then do something like this (I think)

------------------------
<%
filename = server.mappath("") ' Fill in the filename e.g. test.pdf,

Response.Buffer = True

dim objFSO, objTS
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objTS = objFSO.OpenTextFile(fileName)

sFileType= Right(fileName,4)
NameFile=Right(FileName,Len(FileName)-InstrRev(FileName,"\"))
Select Case strFileType
Case ".asf"
ContentType = "video/x-ms-asf"
Case ".avi"
ContentType = "video/avi"
Case ".doc"
ContentType = "application/msword"
Case ".zip"
ContentType = "application/zip"
Case ".xls"
ContentType = "application/vnd.ms-excel"
Case ".gif"
ContentType = "image/gif"
Case ".jpg", "jpeg"
ContentType = "image/jpeg"
Case ".wav"
ContentType = "audio/wav"
Case ".mp3"
ContentType = "audio/mpeg3"
Case ".mpg", "mpeg"
ContentType = "video/mpeg"
Case ".rtf"
ContentType = "application/rtf"
Case ".htm", "html"
ContentType = "text/html"
Case ".asp"
ContentType = "text/asp"
Case Else
'Handle All Other Files
ContentType = "application/octet-stream"
End Select
response.contenttype=ContentType
response.AddHeader "content-disposition", "inline; filename=" & NameFile

Do While Not objTS.AtEndOfStream
strChunk = objTS.Read(32)
strTmp = ""
For i = 1 to Len(strChunk)
strTmp = strTmp & ChrB(Asc(Mid(strChunk, i, 1)))
Next
Response.BinaryWrite strTmp
Response.Flush
Loop
objTS.Close
Set objTS = Nothing
Set objFSO = Nothing
%>
------------------

Found this by searching the web, by looking at it it _might_ be similar to
what you are after.
In the code you can state the dir where all your files live...but don't
state it in the QS.

Good luck
Stu


"JJ" <nospam> wrote in message
news:4129ea1d$0$29945$cc9e4d1f@news.dial.pipex.com ...
> Hi,
> I am writing a cart in ASP selling downloadable files.
> The files are stored on remote locations i.e.
> http://www.thisfilestore.com/file1.zip
>
> And have different extensions, i.e. they are not all zip files.
> I would like to write a script which cann be called which will allow the
> download of the file, without giving away the url.
>
> Any Ideas/examples welcome!
> Thanks in Advance
> JJ
>
>





All times are GMT. The time now is 09:57 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.