Welcome, Guest ( Customer Panel | Login )




 All Forums
 VPCart Forum
 General help me questions
 V5 Option Pack Secure Download
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Gabriel
Starting Member

21 Posts

Posted - August 29 2003 :  13:34:20  Show Profile  Reply with Quote
I can not seem to get the secure download feature to work. I get the link at the end of the order, but when I click it, I get an error saying the file does not exist, which it does not. Nothing is ever copied from my payload folder to my staging folder. Anyone have any info to share?

Gabriel
Starting Member

21 Posts

Posted - September 02 2003 :  18:53:36  Show Profile  Reply with Quote
I got the download working; then I noticed that the secure download is extremely slow to start when dealing with large files. I have been able to speed it up by doing the following:

1) Comment out CopyFile in ShopDownload.asp. Copying the file serves no purpose because the data is written to the Response stream using BinaryWrite meaning the file can be anywhere and does not have to be in a folder accessable to the web.

2) Replace the DownloadFile Sub in the ShopDownload.asp with the following:

Sub DownloadFile (realfile, stagingfile, filename)
' debugwrite "staging=" & stagingfile & " file=" & filename
response.clear
Dim oStr
Dim sFile
sfile=stagingfile

Set oStr = server.CreateObject("ADODB.Stream")
oStr.Open
'oStr.LoadFromFile stagingfile
oStr.LoadFromFile realfile
Response.ContentType = "xxx/xxx"
Response.AddHeader "content-disposition", "attachment; filename=" & filename
Dim Buff
Do
Buff = oStr.ReadText(1024)
Response.BinaryWrite buff
Response.Flush
Loop Until IsNull(buff)
end sub


Now when the download link is clicked the browser's download dialog is displayed instantly instead of 5 minutes later.

Go to Top of Page

shreddemon
Starting Member

3 Posts

Posted - September 03 2003 :  11:29:42  Show Profile  Reply with Quote
Here's what I'd like to do. How do you setup the shopthanks.asp page to give the user a link to click to download a file from a secure site? After a customer makes a purchase, the shopthanks.asp page creates a printable reciept that should include link for them to click on to start downloading thier purchase. How do I set that up?

Edited by - shreddemon on September 03 2003 11:32:24
Go to Top of Page

Gabriel
Starting Member

21 Posts

Posted - September 03 2003 :  15:38:39  Show Profile  Reply with Quote
That feature is included with v5 Option pack.

When the customer is done and the payment method was one of the approved methods, then a link is generated to download from the receipt page. Check this out:
http://www.vpasp.com/virtprog/vpasp500optiondesign.pdf

The modification I made was to the secure download seciton of the option pack because some of the things VPASP did in the code did not make sense to me and seemed to just be wasting time and server resources and created some security issues.





I have had a chance to clean up the download function a bit more:




Sub DownloadFile (realfile, stagingfile, filename)
response.clear
Dim oStr
Dim sFile
sfile=stagingfile

dim fso, f, sizeof
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile(realfile)
SizeOf = f.Size
Set f = nothing
set fso = nothing

Set oStr = server.CreateObject("ADODB.Stream")
oStr.Open
oStr.LoadFromFile realfile
Response.ContentType = "application/octet-stream"
Response.AddHeader "content-disposition", "filename=" & filename
Response.AddHeader "Content-Length", SizeOf
Dim Buff
Do
Buff = oStr.ReadText(1024)
Response.BinaryWrite buff
Response.Flush
Loop Until IsNull(buff) or buff = ""
end sub


Edited by - gabriel on September 03 2003 15:43:04

Edited by - gabriel on September 04 2003 09:48:29
Go to Top of Page

maduko
VP-CART New User

52 Posts

Posted - October 26 2006 :  06:12:18  Show Profile  Reply with Quote
Great idea- but I get this error.....

Microsoft VBScript runtime error '800a01f4'
Variable is undefined: 'CopyFile'
/shopping/shopdownload.asp, line 28

I tried adding Dim CopyFile and then I got Type Mismatch. Any suggestions?

Edited by - maduko on October 26 2006 14:18:40
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000
0 Item(s)
$0.00