473,320 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Disguise URL of downloadable file

JJ
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
Jul 19 '05 #1
3 2192
#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:41***********************@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

Jul 19 '05 #2
"JJ" <nospam> wrote in message
news:41***********************@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
Jul 19 '05 #3
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:41***********************@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

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Boniface Frederic | last post by:
Hello, I want to set some files downloadable only by members with login and password. I use session to protect my .html and .php files, but I would like to know how to protect .zip files....
9
by: Xah Lee | last post by:
is the Microsoft javascript doc downloadable? http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jsoriJScript.asp or, is there some other downloadable complete...
2
by: Charles A. Lackman | last post by:
Hello, I have a web site that plays mp3's and wav files, I am using a media player on the site which does not allow for downloading the media, but if you go to properties within the player and...
2
by: TJS | last post by:
is there a downloadable chm help file for asp.net ?
11
by: Nicky Smith | last post by:
Hello, I'm studying a book on VB.net Win apps, and I'm reading a section on events and delegates and raising events. Is it just me, or is this not just subs dressed up as something else? I...
5
by: Christian Decker | last post by:
Hi, I'm trying to figure out how my users may use (or better misuse) the input fields of my site to to insert JavaScript. I'm already replacing all occurencies of "script" in every input field...
3
by: Hongbo | last post by:
Hi, We have a web site which needs user to login. After login, there are some files available for download on some pages. A typical link of such file is like this one:...
2
by: gen_tricomi | last post by:
THE IMPORTANCE OF MAKING THE GOOGLE INDEX DOWNLOADABLE I write here to make a request on behalf of all the programmers on earth who have been or are intending to use the Google web search API...
4
by: Jim Aikin | last post by:
I'd like to learn JavaScript while sitting in my easy chair with my laptop on my lap. Option 1: Buy a wireless router so I can access the plethora of online- only tutorials from anywhere in the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.