navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

ASP file download manager

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> ASP file download manager
Page: [1] 2   next >   >>
 
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
ASP file download manager - 9/30/2005 12:34:11   
I'm having trouble with this script:

Response.ContentType = "application/asp-unknown"
Response.AddHeader "content-disposition","attachment; filename=" & fileName
Set FStream = Server.CreateObject("ADODB.Stream")
FStream.Open()
FStream.Type = 1
FStream.LoadFromFile(filePath&filename)
Response.BinaryWrite FStream.Read()
FStream.Close
Set FStream = Nothing
Response.End


It works fine with everything except for PDF's

for some reason they get corrupted during the file transfer and Acrobat can't open them. They download just fine if you navigate directly to the file itself...

Thru this script I get the following error in Acrobat:
quote:


Acrobat could not open 'filename.pdf' because it is either not a supported file type or because the file has been corrupted (for example, it was sent as an email attachment and wasn't correctly decoded).


Any ideas?

:)

_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)
Spooky

 

Posts: 26603
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: ASP file download manager - 9/30/2005 15:19:19   
Open the pdf with notepad and see if theres a vbscipt error?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to bobby)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: ASP file download manager - 9/30/2005 16:01:57   
well who would have thought, LOL

error '800a0bba'

I've found several reasons for this, applied some of the fixes and nothing works yet... I'll keep looking...

Thanks Spooky...

If anybody knows how to fix this quickly it will save me some google time :)

_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to Spooky)
Spooky

 

Posts: 26603
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: ASP file download manager - 9/30/2005 16:08:23   
Is that all there is?
What size is the original pdf file ?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to bobby)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: ASP file download manager - 9/30/2005 16:15:53   
33.4 KB

ADODB.Stream
error '800a0bba'
File could not be opened.
/ASTMdownload.asp, line 42


line 42:
FStream.Type = 1


I've found a bunch of threads on this error, but so far nothing that fixes the problem...



_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to Spooky)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: ASP file download manager - 9/30/2005 16:19:37   
I've changed my link to redirect directly to the file itself for now, but I'd rather obfuscate the download directory so that my "authorized" visitors (it's in a password protected zone) won't know where things are to bypass the security checkpoint in the future.

I've tried changing the "1" on line 42 to a "0" and a "2" just for S&G but no joy



_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to bobby)
Spooky

 

Posts: 26603
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: ASP file download manager - 9/30/2005 16:20:10   
Does it work if you change to "application/pdf" ?

What happens when you write "filePath&filename" then end the script - is the path correct?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to bobby)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: ASP file download manager - 9/30/2005 16:26:53   
anybody know the ADODB type library for PDF?

Ive found six different ones online and none of them seem to work, LOL

:)

_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to bobby)
Spooky

 

Posts: 26603
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: ASP file download manager - 9/30/2005 16:28:38   
??

Response.ContentType = "application/pdf"

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to bobby)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: ASP file download manager - 9/30/2005 16:30:46   
quote:

change to "application/pdf"


error '80020005'
Type Mismatch

_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to bobby)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: ASP file download manager - 9/30/2005 16:32:39   
quote:

Response.ContentType = "application/pdf"

Back to the original error...

it's a vicious cycle... :)

_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to bobby)
Spooky

 

Posts: 26603
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: ASP file download manager - 9/30/2005 16:33:52   
Did you check the file path?
Is the directory browseable?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to bobby)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: ASP file download manager - 9/30/2005 16:36:41   
Yes to both...

I'm gonna go try something else real quick...


_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to Spooky)
Spooky

 

Posts: 26603
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: ASP file download manager - 9/30/2005 16:39:56   
Bobby....put down the gun......We will get through this....

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to bobby)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: ASP file download manager - 9/30/2005 16:58:57   
LOL

No, my gun... MINE!

:)

I tried moving the folder from /downloads/ASTM/ to simply /ASTM/ and it still didn't work... I can navigate directly to the files and view / download but not via the script.

Works fine for now, but I don't like having the file path visible in the browser...

:)

_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to Spooky)
Spooky

 

Posts: 26603
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: ASP file download manager - 9/30/2005 17:10:12   
I havent seen too many issues with pdfs.
Other than file permissions and file sizes, they tend to do the same as any other files.
Whats the complete script?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to bobby)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: ASP file download manager - 9/30/2005 17:16:29   
a form posts the document name to this:
<%
if request.form("file") <> "" then
	 response.redirect "download.asp?f=" & request.form("file") & ".pdf"
else
%>


which works fine. The script on download.asp looks like this:
<@ Language=VBScript %>

<%Response.buffer=True

filePath = "d:\http_root\member\public_html\ASTM\"


If request.cookies("name")("value") < 1 then
	Response.redirect "login.asp"
End If

fileName = request.querystring("f")

Response.ContentType = "application/pdf" 
Response.AddHeader "content-disposition","attachment; filename=" & fileName
Set FStream = Server.CreateObject("ADODB.Stream")
FStream.Open()
FStream.Type = 1
FStream.LoadFromFile(filePath&filename)
Response.BinaryWrite FStream.Read()
FStream.Close
Set FStream = Nothing
Response.End

'////////////////////////////////////////
%>


It has worked fine with other downloads... this is the first time I've specifically tried to grab a PDF with it...

I think I'm gonna go see a movie now... will worry about this next week. If anybody has ideas help is greatly appreciated.

B


_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to Spooky)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: ASP file download manager - 10/4/2005 16:49:14   
still nada...

just to clarify: if this directory didn't have read access I wouldn't be able to pull up the files directly via browser either, correct?



_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to bobby)
Spooky

 

Posts: 26603
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: ASP file download manager - 10/4/2005 18:29:00   
I believe correct?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to bobby)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: ASP file download manager - 10/4/2005 18:52:26   
dang... I was hoping this was a problem my host could take care of quickly. They assure me the permissions are as I need them, and I am able to pull up these files directly (if I circumvent the script)

Back to the old drawing board...

Ever feel like Wil E Coyote chasing the roadrunner?

:)

_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to Spooky)
Spooky

 

Posts: 26603
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: ASP file download manager - 10/4/2005 22:16:30   
If on frontpage - try a different directory. eg /fpdb/ and then mess with the permissions that are available right click / properties

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to bobby)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: ASP file download manager - 10/5/2005 2:07:30   
Not on Frontpage, but I did try moving the directory to see if that changed anything (moved it to the root instead of in another directory)

still no joy

I'm confused. Worked perfectly for everything else so far... nada on these PDF's



_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to Spooky)
Spooky

 

Posts: 26603
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: ASP file download manager - 10/5/2005 15:58:42   
Send me one of those files? Ill stick it on one of our sites and see if the same thing occurs?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to bobby)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: ASP file download manager - 10/5/2005 16:02:00   
sent...

thanks!



_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to Spooky)
Spooky

 

Posts: 26603
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: ASP file download manager - 10/5/2005 16:07:47   
Did you get a verification request from my email?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to bobby)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: ASP file download manager - 10/5/2005 16:18:16   
Got it all, thanks Spooky...

that tells me it's a server issue. off to call the host

:)

_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to Spooky)
Spooky

 

Posts: 26603
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: ASP file download manager - 10/5/2005 16:19:56   
I take it it worked fine for you then on our server?
Did you want a copy of the download code for comparision?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to bobby)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: ASP file download manager - 10/5/2005 16:25:10   
Yep, worked to open and to download... send me a copy if you don't mind, or post it here. I'll compare and see if I've messed something up somewhere.

:)

_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to Spooky)
Spooky

 

Posts: 26603
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: ASP file download manager - 10/5/2005 16:28:49   
The example that I showed you was using the Dev login, it uses a similar download code to you.
Ive sent you a link - check out the download.asp file in that, or perhaps try the whole login to see if that works?


_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to bobby)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: ASP file download manager - 10/5/2005 16:33:00   
got it, thanks Spooky

I'll let you know how it turns out

:)

_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to Spooky)
Page:   [1] 2   next >   >>

All Forums >> Web Development >> ASP and Database >> ASP file download manager
Page: [1] 2   next >   >>
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts