|
-
I don't know crap
download pdf
I have a flash doc that I will publish as an executable file, I want for the recipients of the CD to be able to download a pdf file (specifically pdf, I don't want to convert it to swf or whatever)without having to go on the internet. I want the file to be on the CD. What kind of script do I need to put in the button for the file? Also where do I need to put the pdf file? Thank you in advance for your time and help.
"http://www.geocities.com/hemightbecreative"
-
Banned
Hi,
Zipping the files works well and has the advantage of cutting down the size of the download, however if you have access to a server side scripting language (eg PHP) you can also use that to handle the download of a file (and make sure you get a save dialog, instead of the browser opening the file directly). When the server sends a file to the browser it is sent with a file type the browser uses this to determine what it should do with it, eg if the file type tells the browser it is opening a pdf file it can call up acrobat reader to open the file directly.
PHP can be used to modify the http headers so the file is sent with the content type application/octet-stream (a sort of general purpose type) instead of its normal file type. because the browser doesn't know what to do with a file of this type it simply prompts for the user to save it, to do this you can create a php script like this,
code:
<?php
// download.php
// retrieve the filename to download from the query string of the page
$file = $_GET['filename'];
// send the headers
header("Content-type: application/octet-stream");
header("Content-disposition: attachment; filename=$file");
// and output the contents of the file
readfile($file);
?>
now to download a file you could call the PHP script with getURL,
code:
getURL("download.php?filename=documentfilename.pdf ");
-
Registered User
hi,
I find your post really confusing.
I believe you have a flash projector running of a CD, but I haven't understood where the .pdf file is.
On the same CD? On the web?
If the .pdf file is in the cd, I don't know how you can download it... I guess you download something that's on the internet... But this post (Northcode's proxy) lets you open a .pdf from the cd.
If the .pdf is on the internet:
code:
getURL("http://www.yourdomain.com/file.pdf", "_blank");
This may open or download the file, depeding on the user-se preferences. I guess you may force a download with a server side scripting language like PHP.
-
Registered User
See? NTD provided the script to force the download
I was too slow posting
-
I don't know crap
ok I don't quite understand. I know how to zip a file but not turn it into a php. if I did zip it how would the script change?
"http://www.geocities.com/hemightbecreative"
-
Banned
Hi,
If you zip the file, it is just a getURL call to that file. All zipped files will prompt a download. The PHP method requires a call to a PHP script on a server that supports PHP. You can then use the getURL method to essentially "trick" the browser into a download of the file instead of opening it in it's default application.
-
I don't know crap
ok so on the cd I will have the exe file, the autoexecute file, and a few pdfs, not in any folders. So what would the "url" be to find the file on the CD?
"http://www.geocities.com/hemightbecreative"
-
Banned
Hi,
The methods I posted are for an online environment. If your .exe is developed for offline, check out the link in nunomira's post about the northcode option of opening a .pdf file from an exe.
-
I don't know crap
ok I read the whole thread and some of this stuff is a bit over my head. I downloaded Northcodes proxy and I can't figure it out, the exe doesn't open and I don't understand how to turn my pdf into a BAT file.
"http://www.geocities.com/hemightbecreative"
-
The Flashman
If your PDFs are on the same folder as you EXE, you can use this to download the file:
getURL("file.pdf");
This will open the Dwonload Open/Save dialogue box.
It's that simple. no PHP or any other backend scripts required.
i eat actionscripts for breakfast
-
I don't know crap
problem solved
Thank you everybody for your help, earl223 thank you for understanding what I wanted and providing a sufficient solution. Thank you everyone
"http://www.geocities.com/hemightbecreative"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|