SA-FileUp Secure Download Issue - Please HELP!

D

Dave

Hi Everyone,

I was wondering if anyone has ever successfully used SA-FileUp's download
feature. I am being forced to change from
"ASPSmartUpload" as the server I am moving everything to is using SAFileUp
version 3.2.
I ran through their documentation and found a section called "secure
download", unfortunately, their examples do not work
at all!
On Netscape 7, the file "pretends" to download (after changing the file
extension), but only an empty file is created.
On IE 6, I simply get an Internal Server Error (when calling the
TransferFile method of my object).

Here is the code (verbatim from the documentation):

Set oFileUp = Server.CreateObject("SoftArtisans.FileUp")
Response.ContentType = "application/x-msdownload"
Response.AddHeader "Content-Disposition", "attachment;FileName=""" &
FileName & """"
oFileUp.TransferFile FilePath

I also tried:

Set oFileUp = Server.CreateObject("SoftArtisans.FileUp")
Response.ContentType = "application/x-msdownload"
Response.AddHeader "Content-Disposition", "attachment;FileName=""" &
FileName & """"
Set oFM = Server.CreateObject("SoftArtisans.FileManager")
Set oFile = oFM.GetFile(FilePath)
Response.AddHeader "Content-Size", oFile.Size
oFileUp.TransferFile FilePath

(where I retrieve get the file size)

In ASPSmartUpload, I have no trouble what-so-ever with ANY browser I try
using their download feature.
I use the download feature to grab a file that cannot be accessed via a URI,
so simply using the URI is not an option.

I checked and rechecked my variables "FilePath" and "FileName" and they are
exactly correct (if they weren't, I suppose I would have had an error!).
FilePath="e:\securefiles\" and FileName="testfile.zip"
I also monkeyed around with just about every MIME type their is with the
same results.

Here are the specs:
Server: W2K Server SP4
IIS: version 5.0

Anyway, I would just like to simply see an actual, working and tested
example for IE6, NN7.x, and Opera 6 + with
IIS version 5 running on Win2000 Server SP4.

Thanks!

Dave
 
D

Dave

Answering my own question:

With the exception of Netscape 7 not automatically determining MIME type
(I'll have to put a browser test in for this version),
I have rewritten the code. I have discovered that they had FilePath where
they should have had FullPath. The order in which
object instantiation is also critical. After some experimentation, I have
come up with the following working and tested code:
Note: "FullPath" is something like "d:\myfolder\securefiles\myfile.arj" -
that is the entire tree including the file name.


'create instance of the SA FileManager
Set oFM = Server.CreateObject("SoftArtisans.FileManager")

'create instance of a file object
Set oFile = oFM.GetFile(FullPath)

' this header allows the download box to indicate size and bytes left
Response.AddHeader "Content-Size", oFile.Size

'this sets the MIME type to one that most browsers can use (necessary for IE
5.x) - forces dialog
Response.ContentType = "application/x-msdownload"

set oFile = nothing
set oFM = nothing

'create this object instance last
Set oFileUp = Server.CreateObject("SoftArtisans.FileUp")

'ensures the correct file name will show up in the save as dialog
Response.AddHeader "Content-Disposition", "attachment;FileName=""" &
FileName & """"

'does the actual xfer
oFileUp.TransferFile FullPath

'clean up
set oFileUp = nothing


I hope this is useful to someone else besides me and saves someone lots of
headaches.

Sin.
Dave

-@^@-
(_)
~__~
'''
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top