Download File in flash 8

  • ebodaddy
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Nov 29, 2006
  • Posts: 8
  • Status: Offline

Post December 5th, 2006, 12:15 pm

has anyone figured out how to do this, and if so can u share a .fla file?

Thanks!
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post December 5th, 2006, 12:15 pm

  • Riptcage
  • Novice
  • Novice
  • No Avatar
  • Joined: Dec 05, 2006
  • Posts: 18
  • Status: Offline

Post December 5th, 2006, 3:41 pm

Um, can you be a tad bit more clear on the problem?

Do you mean Upload file using Flash?
  • ebodaddy
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Nov 29, 2006
  • Posts: 8
  • Status: Offline

Post December 6th, 2006, 3:42 pm

ok, sorry about that. How do you force a file download within Flash 8?

For instance, if I had a .jpg and I clicked the my download button it would open up the file browser, instead of opening the jpg inside the browser window.

I've tried researching it, but all I've seen is how to file upload into flash. Thanks for any help you may have.
  • Riptcage
  • Novice
  • Novice
  • No Avatar
  • Joined: Dec 05, 2006
  • Posts: 18
  • Status: Offline

Post December 7th, 2006, 7:51 am

So let me see if i get what your trying to say..

Lets say im viewing a flash project, the project being the .swf file. It shows a jpg and you want to click the jpg so you can download the jpg file?

You said you want the file browser to pop up after clicking 'mydownload'.
You mean the file browser to browse through your files? that would be for an upload.. and that also involves some php scripting.

I just still don't understand what you really want to do..download a file within flash..meaning clicking on some download button within the .swf file so you can download something?
  • ebodaddy
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Nov 29, 2006
  • Posts: 8
  • Status: Offline

Post December 7th, 2006, 1:43 pm

Let's say this is my flash presentation, I want my download button to save the jpg to the computer, like it would if you were to right click it in your browser, and save image as. a separate window opens allowing you to specify where to save it, instead of the jpg just opening up in a new page of Internet Explorer, or whatever browser you are using.
Image



An example of how i would like it to download.
Image
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Joined: Nov 05, 2004
  • Posts: 1254
  • Loc: Ro
  • Status: Offline

Post December 8th, 2006, 3:34 am

force download
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”
  • ebodaddy
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Nov 29, 2006
  • Posts: 8
  • Status: Offline

Post December 8th, 2006, 11:41 am

Thanks once again IceCold.

For those who have thise same question here's how to do it.

in flash link to a php file that's in the same directory as the file you want to download
here is the code you u se in the php file
<?php
header('Content-disposition: attachment; filename=filename.jpg');
header('Content-type: image/jpeg');
readfile('filename.jpg');
?>

it has to be exactly like that
and the content type is different depending on what kind of file you are using. but image/jpeg works for this instance since i am downloading a jpeg file.
  • James R
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Jan 17, 2007
  • Posts: 6
  • Loc: Dublin
  • Status: Offline

Post January 17th, 2007, 4:22 pm

For some reason this isnt working for me..

I just get:

The page cannot be found
The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.


I have the fgollowing code on my button:

dl1_btn.onRelease = function(){
getURL("Mixes/triggerjanmix.php");
};

and in my php file i have:

<?php
header('Content-disposition: attachment; filename=trigger--januarys_blue[jan_07].mp3');
header('Content-type: audio/mp3');
readfile('trigger--januarys_blue[jan_07].mp3');
?>

Any ideas as to what i'm doing wrong?

Thanks
James.
  • James R
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Jan 17, 2007
  • Posts: 6
  • Loc: Dublin
  • Status: Offline

Post January 17th, 2007, 4:25 pm

ps - the php file is located in the Mixes folder and is being called correctly in the browsers address bar.
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Joined: Nov 05, 2004
  • Posts: 1254
  • Loc: Ro
  • Status: Offline

Post January 18th, 2007, 3:55 am

you test this on your own comp or on a server?
if so, does it have php support?
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”
  • James R
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Jan 17, 2007
  • Posts: 6
  • Loc: Dublin
  • Status: Offline

Post January 18th, 2007, 4:51 am

On the server. I was thinking that in the back of my mind. I didn't pick the server originally so not sure if it supports php... I'll go have a gander.

Thanks Icecold..
  • James R
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Jan 17, 2007
  • Posts: 6
  • Loc: Dublin
  • Status: Offline

Post January 18th, 2007, 6:35 am

Can't seem to get in touch and find out if the server supports php, but I'm presuming it doesnt. Is there any other way around this force download issue?

Or sould I reluctently put the mp3 into a zip file.
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Joined: Nov 05, 2004
  • Posts: 1254
  • Loc: Ro
  • Status: Offline

Post January 18th, 2007, 10:24 pm

create a html page with this code inside it, place it on the server and see if it downloads it when u press the link:
Code: [ Select ]
<html>
header('Content-disposition: attachment; filename=filename.jpg');
header('Content-type: audio/mp3');
<body>
  <a href="trigger--januarys_blue[jan_07].mp3">download file</a>
</body>
</html>
  1. <html>
  2. header('Content-disposition: attachment; filename=filename.jpg');
  3. header('Content-type: audio/mp3');
  4. <body>
  5.   <a href="trigger--januarys_blue[jan_07].mp3">download file</a>
  6. </body>
  7. </html>

But, if you want dynamic links ... you will need a server side script.
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”
  • James R
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Jan 17, 2007
  • Posts: 6
  • Loc: Dublin
  • Status: Offline

Post January 19th, 2007, 8:58 am

hmm interesting, it opens up a blank page with the following on it:

"header('Content-disposition: attachment; filename=filename.jpg'); header('Content-type: audio/mp3'); download file"

And you can download from the link^
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Joined: Nov 05, 2004
  • Posts: 1254
  • Loc: Ro
  • Status: Offline

Post January 21st, 2007, 10:55 pm

aah, i forgot about the <head> tag.
add it like this: <html><head>.......</head><body>
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post January 21st, 2007, 10:55 pm

Post Information

  • Total Posts in this topic: 19 posts
  • Users browsing this forum: No registered users and 34 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.