Forums
This topic is locked
Protecting Digital downloads
Posted 02 Aug 2005 01:34:09
1
has voted
02 Aug 2005 01:34:09 Seb Adlington posted:
Hi,Have just finished a site which is basically a photo gallery for a photographer looking to sell his artwork - you can browse images, bung them in a basket then pay for them via Paypal - The site then sends an email with a set of login details for you to go and retrieve your images within 7 days.
I was originally going to keep the hi-res pictures in a private folder outside the public web folder but our hosts have just told us we can't link to images in a private folder. If i leave the pictures in the main site folder then anyone can download them.
Any ideas how to go about doing a secure digital download. Can't really see how to hide the address in a browser window where you can view the source or see the link.. and we'd rather not change hosts as we've now uploaded 1.5Gigs worth of big photos!
Thanks
Seb
Replies
Replied 04 Aug 2005 21:45:51
04 Aug 2005 21:45:51 Daniel Severns replied:
You could store the name, title, and path to the picture in a database and create a page that only shows the url as page?pictureid=123497234692387 then force them to get the dialog box that says , open save, cancel...
Check out the tutorial at this site and then the post on the forum which explains how to force open the dialog box.
webthang.co.uk/tuts/tuts_dmx/rob13/rob13.asp
webthang.co.uk/forum/code_replies.asp?offset=275&ID=4294
--------------------
MtnManDan
www.curiouscal.com
Check out the tutorial at this site and then the post on the forum which explains how to force open the dialog box.
webthang.co.uk/tuts/tuts_dmx/rob13/rob13.asp
webthang.co.uk/forum/code_replies.asp?offset=275&ID=4294
--------------------
MtnManDan
www.curiouscal.com
Replied 05 Aug 2005 00:59:51
05 Aug 2005 00:59:51 Seb Adlington replied:
Thanks for that m8,
got it working eventually using popups and ADODB.Stream - was a bit of a pain trying to get it to get around the IIS file size limit
but it now downloads 20mb+ files without any trouble and the urls are buried in a database as you suggest.
If the code i used is of any interest let me know
Cheers
Seb
got it working eventually using popups and ADODB.Stream - was a bit of a pain trying to get it to get around the IIS file size limit
but it now downloads 20mb+ files without any trouble and the urls are buried in a database as you suggest.
If the code i used is of any interest let me know
Cheers
Seb
Replied 05 Aug 2005 21:01:16
05 Aug 2005 21:01:16 Daniel Severns replied:
Yes, the example on the second link I provided does just that.
Good for you though!! I'm glad you got it sort <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
--------------------
MtnManDan
www.curiouscal.com
Good for you though!! I'm glad you got it sort <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
--------------------
MtnManDan
www.curiouscal.com
Replied 06 Aug 2005 01:55:53
06 Aug 2005 01:55:53 Seb Adlington replied:
Well I thought I had it sorted but it turns out that any files over about 19MB timout if you are using a MAC with Safari
typically my customer is a designer guy and most of his client base are using the same - I guess there is some timeout/
buffer screw up going on - am back to the drawing board which is a pain as it seems to work fine on a PC with IE <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>
thanks for the input MtnManDan - u r a dude
typically my customer is a designer guy and most of his client base are using the same - I guess there is some timeout/
buffer screw up going on - am back to the drawing board which is a pain as it seems to work fine on a PC with IE <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>
thanks for the input MtnManDan - u r a dude
Replied 06 Aug 2005 01:57:17
06 Aug 2005 01:57:17 Seb Adlington replied:
PS - this is the code just in case....
<%
Function downloadFile( )
'------------
Dim fileName, filePath, mimeType, Asize, i,strFile, strDownloadFilename
fileName = Recordset1.Fields.Item("PicID"
.Value &".jpg"
strDownloadFilename = filename
strFile = filename
Asize=Recordset1.Fields.Item("ImageSize"
.Value
filePath = "..\private\" & Asize & "\"
mimeType = "jpeg"
'-------------------
Dim strFilename,objStream,objFilesystem,objFilestream
Dim intFileLength
' get full path of specified file
strFilename = Server.MapPath(filePath & fileName)
' clear the buffer
Response.Buffer = True
Response.Clear
' create stream
Set objStream = Server.CreateObject("ADODB.Stream"
objStream.Open
' set as binary
objStream.Type = 1
' check the file exists
Set objFilesystem = Server.CreateObject("Scripting.FileSystemObject"
if not objFilesystem.FileExists(strFilename) then
Response.Write("<h1>Error</h1>: " & strFilename & " does not exist<p>"
Response.End
end if
' get length of file
Set objFilestream = objFilesystem.GetFile( strFilename )
intFilelength = objFilestream.size
objStream.LoadFromFile( strFilename )
if err then
Response.Write("<h1>Error: </h1>" & err.Description & "<p>"
Response.End
end if
'format strFileName
if Len( Trim(strDownloadFilename) ) > 0 then
strDownloadFilename = Trim( strDownloadFilename )
else
strDownloadFilename = objFilestream.name
end if
' Response.ContentType = "SENTREnet"
' send the headers to the users browser
Response.AddHeader "Content-Disposition", "attachment; filename=" & strDownloadFilename
Response.AddHeader "Content-Length", intFilelength
Response.Charset = "UTF-8"
' output the file to the browser
' Response.BinaryWrite objStream.Read
' Response.Flush
for i = 0 to objStream.size
i = i + 128000
Response.BinaryWrite(objStream.Read(128000))
Response.Flush
next
' tidy up
objFilestream.Close
Set objFilestream = Nothing
window.close()
End Function
%>
<%
Function downloadFile( )
'------------
Dim fileName, filePath, mimeType, Asize, i,strFile, strDownloadFilename
fileName = Recordset1.Fields.Item("PicID"

strDownloadFilename = filename
strFile = filename
Asize=Recordset1.Fields.Item("ImageSize"

filePath = "..\private\" & Asize & "\"
mimeType = "jpeg"
'-------------------
Dim strFilename,objStream,objFilesystem,objFilestream
Dim intFileLength
' get full path of specified file
strFilename = Server.MapPath(filePath & fileName)
' clear the buffer
Response.Buffer = True
Response.Clear
' create stream
Set objStream = Server.CreateObject("ADODB.Stream"

objStream.Open
' set as binary
objStream.Type = 1
' check the file exists
Set objFilesystem = Server.CreateObject("Scripting.FileSystemObject"

if not objFilesystem.FileExists(strFilename) then
Response.Write("<h1>Error</h1>: " & strFilename & " does not exist<p>"

Response.End
end if
' get length of file
Set objFilestream = objFilesystem.GetFile( strFilename )
intFilelength = objFilestream.size
objStream.LoadFromFile( strFilename )
if err then
Response.Write("<h1>Error: </h1>" & err.Description & "<p>"

Response.End
end if
'format strFileName
if Len( Trim(strDownloadFilename) ) > 0 then
strDownloadFilename = Trim( strDownloadFilename )
else
strDownloadFilename = objFilestream.name
end if
' Response.ContentType = "SENTREnet"
' send the headers to the users browser
Response.AddHeader "Content-Disposition", "attachment; filename=" & strDownloadFilename
Response.AddHeader "Content-Length", intFilelength
Response.Charset = "UTF-8"
' output the file to the browser
' Response.BinaryWrite objStream.Read
' Response.Flush
for i = 0 to objStream.size
i = i + 128000
Response.BinaryWrite(objStream.Read(128000))
Response.Flush
next
' tidy up
objFilestream.Close
Set objFilestream = Nothing
window.close()
End Function
%>
Replied 11 Aug 2005 16:30:22
11 Aug 2005 16:30:22 Daniel Severns replied:
Unfortunatly, your host has the say so on when file downloads or request from the server time out. That looks like your problem here. What exactly are your clients downloading? Is it a single picture or something else? Could you compress it or segment the file for download? 20mb seems like a large download, how on earth can you afford the bandwidth charges?
--------------------
MtnManDan
www.curiouscal.com
--------------------
MtnManDan
www.curiouscal.com
Replied 27 Aug 2005 15:19:00
27 Aug 2005 15:19:00 Seb Adlington replied:
Hi Dan,
Got it all sorted eventually - Turned out it was working ok for everyone except my client - think he had Norton or similar that was screwing his download up every 5th time he tried. No worries on the bandwidth score - the client has an account with virtually unlimited bandwidth - something on the order of 20Gig - and seeing the prices he wants to charge for his photos, there are not going to be a big flood of downloads.
If you want a look at the finished site see www.1stroyaltyfree.com
Cheers
Seb
Got it all sorted eventually - Turned out it was working ok for everyone except my client - think he had Norton or similar that was screwing his download up every 5th time he tried. No worries on the bandwidth score - the client has an account with virtually unlimited bandwidth - something on the order of 20Gig - and seeing the prices he wants to charge for his photos, there are not going to be a big flood of downloads.
If you want a look at the finished site see www.1stroyaltyfree.com
Cheers
Seb