473,699 Members | 2,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Download via Flash

neliy
32 New Member
Hey there. I need to add a link in my current project from which the user will be able to download some images. I tried to find a tutorial to find the way or an actionscript example but I couldn't. Can someone help me plz? thnx
Sep 5 '07 #1
6 4169
xNephilimx
213 Recognized Expert New Member
Hi, neliy.
I don't anderstand what are you trying to do... You mean, adding a link that when the user clicks it it is promped to download the file (without givin the option to view it)?

Kind regards,
The_Nephilim

Hey there. I need to add a link in my current project from which the user will be able to download some images. I tried to find a tutorial to find the way or an actionscript example but I couldn't. Can someone help me plz? thnx
Sep 6 '07 #2
neliy
32 New Member
Hi, neliy.
I don't anderstand what are you trying to do... You mean, adding a link that when the user clicks it it is promped to download the file (without givin the option to view it)?

Kind regards,
The_Nephilim
Exactly what you said. The images are already viewable by thumbs and by clicking on it I need the download file window to appear in order for the user to get the image. Plz help
Sep 6 '07 #3
xNephilimx
213 Recognized Expert New Member
Oh, ok.
That can be done only server side, in my case php. There's no way to do it client-side.
The getURL method in ActionScript should read this for example:
Expand|Select|Wrap|Line Numbers
  1. getURL("download.php?f=path/to/image.jpg");
  2.  
the download.php is the php file that will handle the file to be downloaded, the f=path/to/image.jpg is a variable f being passed in GET method to the donwload.php file, so it will know which file must be used and where it is.

The code in php should be like this:
[PHP]
<?php

$thefile = $_GET['f'];
$ext = substr($thefile ,-3);
if($ext == "jpg") $ext = "jpeg";
header('Content-type: image/' . $ext);
header('Content-Disposition: attachment; filename="' . $thefile . '"');
readfile($thefi le);

?>
[/PHP]

The first line, just catches the f parameter passed through the URL (GET method) and stores it in the $thefile variable.
The second line extracts the last 3 characters -the extension of the file- and stores it in $ext.
Then if the extension is jpg it changes it to jpeg because when we define the content-type, the jpg content-type is image/jpeg, but the rest could be image/gif and image/png if those where the cases.
So then we define the actual content-type, then the content-disposition, that is how will be the content treated as, in this case like an attachment, adn we pass as the filename prameter the file that was passed from flash.
Then we output the file with the read function, that way our php file "becomes" the image to be downloaded.
The browser then will prompt the user to download the file.

Kind regards,
The_Nephilim

Exactly what you said. The images are already viewable by thumbs and by clicking on it I need the download file window to appear in order for the user to get the image. Plz help
Sep 6 '07 #4
neliy
32 New Member
That was more than I was expected! your a legend! thank you
Sep 7 '07 #5
xNephilimx
213 Recognized Expert New Member
LOL! You're welcome!
Glad it helped you.

Best regards,
The_Nephilim

That was more than I was expected! your a legend! thank you
Sep 7 '07 #6
lavertyj
1 New Member
This is awesome. I was looking for a way to do this as well. I am using it to download an xml file. The person can then make changes and upload it again. The problem I am having is that safari will not let the xml file download. Works fine in firefox though. Any ideas to make this work in safari.
Feb 10 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

8
3308
by: lawrence | last post by:
Under the domain publicpen.com I've several dozen sites in subdiretories, such as www.publicpen.com/honenbeger. I've no trouble with any of these sites. But under one, which I put in yesterday, www.publicpen.com/staengl, when I point my browser there, the browser, instead of showing me the index.htm pages like it should, it instead tries to download it as an object. Why? Below are the contents of index.htm. Does anyone see anythging...
0
1387
by: Martin Raychev | last post by:
Hi everybody, I have a need for a web app that will allow a flash client to download files at a specified speed. I am using Flash for an application of mine which downloads JPG slides to users' web based app. Because I can't control how quickly a file (in this case, a JPG slide) is
0
1933
by: Sarah Akers | last post by:
GgF ----gL5cJ72EqiGIQ0SK65Rz Content-Type: text/html; Content-Transfer-Encoding: quoted-printable <html> <head> <style type=3D"text/css">.eyebrow { FONT-WEIGHT: bold; FONT-SIZE: 10px; TE=
0
1937
by: Anne Snow | last post by:
7qs ----bSCMEc0pLIbJxmV9 Content-Type: text/html; Content-Transfer-Encoding: quoted-printable <html><head><style type=3Dtext/css>.eyebrow { FONT-WEIGHT: bold; FONT-SIZE= : 10px; TEXT-TRANSFORM: uppercase; COLOR: #ffffff; FONT-FAMILY: verdana,ar= ial,helvetica,sans-serif; TEXT-DECORATION: none } A.eyebrow:link { TEXT-DE= CORATION: none }</style><title>6</title><meta http-equiv=3DContent-Type co=
0
1815
by: Lynda Kilgore | last post by:
jGu ----qtHwhORV90yyhqJMOc Content-Type: text/html; Content-Transfer-Encoding: quoted-printable <html><head><style type=3Dtext/css>.eyebrow { FONT-WEIGHT: bold; FONT-SIZE= : 10px; TEXT-TRANSFORM: uppercase; COLOR: #ffffff; FONT-FAMILY: verdana,ar= ial,helvetica,sans-serif; TEXT-DECORATION: none } A.eyebrow:link { TEXT-DE= CORATION: none }</style><title>H</title><meta http-equiv=3DContent-Type co=
0
1945
by: Ron Vecchi | last post by:
Hello, Through using this and many other Microsoft dotnet newsgroups I have been pointed towards many helpful open source projects and articles that have helped a great deal in my studies as well as projects. Recently I have been using a lot of Macromedia Flash Movies within my asp.net pages, as many people have. For those familiar with Flash macromedia can publish the html output for you so you only need to copy/paste to your...
11
3049
by: moondaddy | last post by:
I have images that I need to prevent the user from doing a right click and selecting "Save Picture As"? How can I do this? -- moondaddy@nospam.com
1
2265
by: pixelmeow | last post by:
Hello all, I have just started work on a website that had some obnoxious flash that the owner wanted removed. I removed the intro page and two flash objects from the index page. The owner then let me know that she wanted one of them put back, so I put it back and reloaded the page. The problem now is that when you browse to the page, you get the little window that says you need to install the Flash Player to view the page and that the...
12
4017
by: Bob Bedford | last post by:
I've to build a website where the customer can buy an image. I'm thinking in the 2 ways to let people get those images: receive them by Email or send them an image link wich validity is limited in time. The second may help me to know if an image has been downloaded and how many times. How to build such download link ? The informations I'd like is the userid, the datetime limit and the imagefile, off course everything must be encrypted...
0
9187
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8936
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8894
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7777
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6544
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5879
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4390
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2361
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.