« Oinam Blog Oinam Blog at MXNA »

Flash 8 File Upload Download

We have completed an example of one of the new feature in Flash Player 8, the File Upload/Download - FileReference. The current demo have a parameter to control the MAX size of the individual files that can be uploaded. This value is changeable via the FlashObject variables in the SWF embedded html. The current demo is also configured to save the uploaded files to a directory, “userUploads”.

Sypnosis

Flash Developers have been asking for File Upload download functionality in Flash for a long time now. This time round, Macromedia finally decided to put in this functionality in the Flash 8 Player. And the better news is that the API that has been provided allows for uploading not just one but multiple files as well. This example shows how multiple files can be uploaded to the server using a simple upload queue. The upload queue groups together multiple upload requests and provides unified progress events for the entire group. This helps us provide the user with a single progress display even when uploading multiple files.

The possibilities this opens up for flash RIA’s is amazing. Imagine populating an entire photo gallery with a Select All + Upload combo. Flash developers now not only have file uploads but the usability of multiple file uploads, which beats other current implementations as well.

FootNote

Express Install
This example is combined with the Express Install feature of Flash Player 8, whereby if your Flash Player vesion is earlier to 8, it will try to do an Express Install.

Image Preview before Download
There is also an Image Preview before you Download a particular Image.

ColdFusion
The file drop routine can be done by any Server Side Script, for example, there is a C#.NET upload script. Our example uses ColdFusion for dropping the uploaded file to the server and the CF code was just one single line

Here are the corresponding upload Routines for Reference.

C#.NET
Via Shunjie Blog

string saveToFolder = “savedFiles”
private void Page_Load(object sender, System.EventArgs e)
{
HttpFileCollection uploadedFiles = Request.Files;
string Path = Server.MapPath(saveToFolder);
for(int i = 0 ; i 0)
{ 
string newName = F.FileName.Substring(F.FileName.LastIndexOf(”\\”) + 1);
F.SaveAs(Path + “/” + newName);
}
}
}

PHP Code
Thanks to Tink for helping out with the PHP Code.

Comments

  1. g.wygonik | August 24th, 2005 | 11:10 pm

    unless there’s a security setting change you need to make, it appears that the player doesn’t like files that are on a network device (that is, their not local files).

    it will browse to them, but always display 0 k for file size and give an error when your “Upload” button is pressed. hopefully something that will be fixed before release…

    :-)
    g.
    WinXP Pro, Firefox 1.0.6

  2. Philippe Maegerman | August 25th, 2005 | 9:26 am

    Wonderful news (multiple files)
    Do you plan to show some of the as code?

  3. CodeCanvas | August 30th, 2005 | 5:30 am

    Flash 8 File Upload and Download

  4. Neil Robertson-Ravo | August 30th, 2005 | 8:43 am

    Can you post the FLA and CFM so we can get at it? This is way cool! (or post offline!)

  5. Nicolas Cacace | August 31st, 2005 | 12:45 am

    I can see that Flash Uploads and Downloads Files. Can Flash 8 write to file as a standalone application?

  6. satish | September 5th, 2005 | 7:46 am

    Hi

    Please tell me that this file upload and download example in flex how we can implement ..

  7. Darren Cole | September 7th, 2005 | 12:43 am

    Is there any chance of someone posting a PHP version of the viewFiles.cfm file please?

  8. Morris | September 7th, 2005 | 9:49 am

    And Asp Example when???

  9. Madhukar Vats | September 10th, 2005 | 6:58 pm

    Flash 8 doesn’t support animated gif.It consider the animated gif as a still image.

  10. Roberto Marras | September 12th, 2005 | 11:39 am

    I can see that Flash Uploads and Downloads Files. Can Flash 8 write to file as a standalone application?

    I don’t think flash can write to a file, however the php is very easy for that so the both combined could do that job easy.

  11. Abhishek | September 14th, 2005 | 7:35 am

    I am not able to create a
    HandCursor on the context Menu.Please guide me
    Thanks

  12. Tania | September 15th, 2005 | 2:32 am

    I dont know if anyone still needs this, but the code for viewFiles in php is:

    bc[as].

  13. Fab's blog | September 15th, 2005 | 1:27 pm

    Flash 8

    Il vient de sortir et il contient un paquet de nouveautés : Macromedia

    Pour en voir quelques unes…

  14. lijko | September 16th, 2005 | 8:52 pm

    hey,

    when i try to export movie from fileuploaddownload.fla, i got this error:

    **Error** C:\Documents and Settings\Administrateur\Bureau\fileuploaddownload\flash\com\oinam\controls\PhotoPane.as: Line 92: There is no method with the name 'dispose'.
         		super.dispose();

    why? i didn’t modify the folder

    somebody could help me???

    thx anyway, pretty good job from oinam

  15. Larry | September 17th, 2005 | 1:54 am

    Can i get the FLA for this please, it would really help me out ?

    Thanks

  16. lijko | September 19th, 2005 | 9:48 pm

    hey, here’s a bug, if you select several files (with a weight over 50kb), it uploads nayway…

    thx anyway, pretty good job

  17. CJ | September 20th, 2005 | 4:45 am

    Thanks for posting these examples!!

    I can’t get the aspx page to see any files in the Request.Files collection? Any tricks to get this working?

  18. Mike Givens | September 21st, 2005 | 3:31 pm

    Would love to see the ActionScript for dosplaying the uploaded file’s filename at a minimum, but the FLA would be supreme :-)

    Great article, by the way.

    Mike G

  19. kuimoani | September 23rd, 2005 | 8:59 am

    Can you upload without OpenDialogWindow?

  20. dani silveiro | September 26th, 2005 | 3:47 pm

    i see that this example covers preview from the server before download…cool :)
    but what i need to do is the complete oposite preview from the users disk before upload is this possible ?

  21. Michelle Sintov | September 27th, 2005 | 12:07 am

    Some answers to the questions here:

    Flash Player 8r22 has a bug where on Windows, files that are not on your local device cannot be uploaded. The Mac player doesn’t have this bug.

    Regarding the dialog box for selecting the file to upload or a location to download, you cannot avoid the Flash Player bringing up this dialog box.

    Full FileReference documentation is here:
    http://livedocs.macromedia.com/flash/8/main/00002204.html

  22. jason | September 28th, 2005 | 11:53 am

    cant get the download section to work with the php code above, anyone here get that to work with php. Any help would be great. thnks

  23. Norman | September 30th, 2005 | 8:10 pm

    Any CFM or CFC Example?

  24. Dave | October 8th, 2005 | 3:22 am

    I’m using the php method and I got it to upload fine but the download section doesnt work, in the “select file for download” area it says undefined (NaNkb) any ideas what I’m doing wrong?

  25. Dan Blackman | October 12th, 2005 | 7:50 pm

    Can I get the FLA file to understand this better?

    Thanks

  26. Andreas | October 13th, 2005 | 8:48 pm

    Please!!!!
    I can’t get the flash upload to work. All I get is a login prompt asking me for username/password. Why??? In a desperate atempt I even gave INET_USR administrator priviviliges!!!!

    Does any no whats wrong?

  27. Aaron | October 13th, 2005 | 9:52 pm

    Can you preview the selected images before uploading in flash 8?

  28. Lar | October 14th, 2005 | 7:29 pm

    I downloaded your example and got it to work with CFM in IE but fails to upload when using Firefox.
    Your online sample works with Firefox, what am I missing with your example on my host?
    Do I need some sort of policy file or other security measure for non-IE browsers? Frustrated big time with the Firefox issue, works in IE as it should but not Firefox. The download even works fine with Firefox just the upload aspect is fubar.
    Any help is much appreciated, thanks.

  29. Tomas | October 17th, 2005 | 4:30 pm

    Is there any way how to pass more information with the uploaded file?For istance I would like to make an description TextBox and pass value of the TextBox with file to the server.

  30. Spiro Mifsud | October 18th, 2005 | 1:09 am

    Use this instead for the viewer portion. The other PHP doesn’t echo the proper XML

    bc[as].

  31. russland | November 3rd, 2005 | 11:54 am

    hi, got the same question as andreas. is there a way to preview local images with the new flash 8 objects?

  32. Steven Hargrove | November 4th, 2005 | 2:41 am

    hey this is awesome,

    I’ve created a corresponding viewFiles.php for those who are like me and love php.

    you can download it here: http://blog.digidogstudios.com/fileupload_viewfiles_script.zip

    hope that helps!

  33. pixelone | November 4th, 2005 | 8:38 pm

    Has anyone ever tried uploading a video. .mov, or even .wmv?

    I mean every single tutorial seems like it is a re-hash of the one Flash 8 has in it’s sample file. Meaning only images are being uploaded. Can someone help me figure out how to upload movies.

    Thank you. I have got it to where it is recognizing the file extentions

  34. Ol | November 9th, 2005 | 9:05 pm

    does anyone have the PHP version of the viewFiles.cfm

    It seems it was posted above but all I see is bc[as]

  35. LB Back | November 14th, 2005 | 2:44 pm

    Hi,
    Great example of filereference! Does anyone have a working viewFiles.php ?
    I can only upload sofar.

  36. Brajeshwar | November 14th, 2005 | 4:01 pm

    Hi Pixelone,

    The filetype was restricted to Image files as they are rather harmless. You can allow any filetype to be uploaded. I hope you have checked the source file for the same.

  37. mona | November 15th, 2005 | 10:13 am

    Is there a way to add a delete function, so that someone can delete the useless files from server?

  38. LB Back | November 15th, 2005 | 11:05 am

    russland, thx a mil! This works like a charme :D

  39. Jburton | November 15th, 2005 | 2:43 pm

    I’m using testing the upload feature with customers now. My DSL customers are getting a Flash I/O error after about 5 or 6 files. My cable customers are having no problem. Anyone have an idea about this? Is it the connection type or a coincidence?

  40. LB Back | November 21st, 2005 | 11:25 am

    Uhhmm, sorry ignore my last post, i meant Steven Hargrove, thx a mil! This works like a charme :D

  41. The Downloads Blog | November 24th, 2005 | 10:34 pm

    Resumable File Downloads with ASP.Net

    Peter AitkenHas this ever happened to you (I bet the answer is

  42. Kcheung | November 30th, 2005 | 11:22 pm

    I can get the FileReference object to upload a file thru a C#/.NET page but i’m running into an interesting issue. While the file uploads correclty to the server, there is another function called in my .net page to save the path to the database. For some reason it doesn’t save the path to the db after uploading the file.

    Does FileReference somehow stop the activity of the page the moment it senses the upload? Anyone else run into this issue?

  43. Øivind | December 8th, 2005 | 2:45 am

    I’m receiving I/O error from flash when I upload files larger than approximately 15-20MB using the C# script on this page.

    Can anybody shed some light on this, as Im rather inexperienced in C# and .net.

    My first thought was that the server script timed out during uploading to server. Other testing on my own webserver showed that was not the case.

    Got clues?

  44. syg | December 8th, 2005 | 7:43 am

    Lar, regarding your Oct 14 Firefox post: this may be happening because you’re trying to use session variables. I’m having the same problem with PHP.

    The example uses javascript to pass variables to the Flash file. IE continues the session, passing it directly to the display file, but Firefox / Mozilla don’t do this. This could be a security bug in IE, but that’s what makes it work.

    One workaround would be to try and substitute the javascript for HTML using param=flashvars. I haven’t tried this yet, but it may work. Let me know how it goes.

  45. oivind | December 8th, 2005 | 1:42 pm

    thought i ougt to mention my discovery. I had problems uploading files over aprox. 20 mB
    A friend told me theres a filesize limit set in the .net framwork. in the file machine.config.
    Now back to nerding……

  46. steff | December 13th, 2005 | 7:58 am

    I try to implement the multiple upload in an ColdFusion Application. I am working with fusebox. I sett the Upload URL with some Variables (looks like http://www.test.com?fuseaction=test.upload&Variable=1&showerror=true)
    After submit it looks like it looses all Variables after the fuseaction! I need them to create the correct upload path dynamic.
    Has anybody experienced the same problem? Any solutions?

  47. Yogz | December 13th, 2005 | 9:25 am

    Does anyone know how to resolve the proxy problem?

  48. Septunas | December 17th, 2005 | 1:08 am

    Why is it impossible to download the last item in the list?
    Is it a bug in the list component?
    I have that prob with me and apparantly it bugs also on this example:
    >>> http://labs.oinam.com/flash8/fileuploaddownload/

  49. Ricardo | December 17th, 2005 | 2:57 am

    I am trying the .net script, but it says Error HTTP 500. Does anybody has a .net sample working???

    8 hours in a row trying to make this work!!!

    Help Please!

  50. tony | December 20th, 2005 | 10:40 am

    Had it working locally, and moved it to the server. Now files will upload successfully, but will not be veiwable in the download preview window. They look fine if downloaded and veiwed normally. Any Ideas?

  51. cb | December 21st, 2005 | 2:09 pm

    I get Security Sandbox errors - I put System.security.allowDomain(”*”);
    in my code but still I get the error -

    Any Help -

  52. Richard | December 21st, 2005 | 11:30 pm

    The URL in FileReference.upload(url.php) does not recognize $_SESSION variables (always undefined even when the session is set) - anyone else experience this or have a solution?

  53. Albert Lai | December 27th, 2005 | 8:15 pm

    Nice demo!

    For those that are intrested, you can see a live version of flash 8 uploading for photosharing here:

    http://www.bubbleshare.com

    (go to the enhanced uploader — but be running firefox or Mac, otherwise it’ll bring you the the activeX uploader)

  54. AzzzY | December 29th, 2005 | 1:19 pm

    Nice demo.
    There is a little error in the source, instead

    if (file.size/1024 > maxFileSize)
    {
      refList.fileList.splice (i, 1);
      invalidFiles++;
    };
    if (file.size/1024 > maxFileSize)
    {
      refList.fileList.splice (i, 1);
      invalidFiles++;
      n--;
      i--;
    };

    Right now the script skips the check for the next file if invalid filesize is found. Also it will be nice if you  set multipleSelection=true for “uploadFilesList” and use uploadFilesList.selectedIndices
    to remove only selected files from the upload queue.
    Thank you for sharing this!

  55. syg | December 30th, 2005 | 11:50 am

    Richard, the only way to pass _SESSION variables is through GET. Pass them through to nextURL.

    If you’re using PHP, you can set up nextURL like this, before opening the javascript tag:
    $passurl=’upload1.php?p=’.$p;

    Then pass the php value within the javascript tag like this:
    var uploadid = ‘\

  56. sundar | January 1st, 2006 | 4:16 pm

    I used the source file but Iam getting error..Iam not a pro in flash..but I need to do this task..I need multiple file upload and got the source from here http://labs.oinam.com/flash8/fileuploaddownload/
    and uploaded to http://lismardts.com/demo/index2.html but IAm getting error..what exactly I need to do can anyone help me with this one.

  57. sygcom at syg dot com | January 6th, 2006 | 6:00 am

    Very nice script - thanks a lot Braj!

    We’ve modified it to do just upload, and are using it at http://fotojuice.com.

    This version uploads multiple files, passes session variables, and works in IE as well as Firefox. I was getting server errors due to PHP setup limits, but that too has been taken care of. Thumbnails are made using PHP’s image functions based on gdlib.

  58. Simon Hewitt | January 12th, 2006 | 12:55 pm

    Some more information would be great.
    I am trying to upload text and dbf data files, and at the moment have to use http://FTP.
    I’ve tried changing the code to read

    fileTypes = [
     {description:"Data Files", extension:"*.txt"}
    ];

    but am getting a securitySandboxError. Any ideas how to rectify this? Images work fine. Also, are there any technical limitations to the filesize that can be sent (by the player, not maxFileSize)

  59. Brajeshwar | January 12th, 2006 | 5:40 pm

    Simon,

    There is a 100mb limit on the files that you can upload in flash player 8. And the player becomes non-responsive if you try such large files.
    Security Sandbox error sounds like a cross-domain issue that should be resolved by using appropriate crossdomain policy files.

  60. steff | January 13th, 2006 | 8:00 am

    Working with ColdFusion, Fusebox:
    Is there a way to give back an ‘message’ about if the upload was successfull or not. In the file with the i tryed to set a FlashVar:

    var vMessage = "successfull";

    … but it didnt work! Has anybody a solution?

  61. aMadeMann | January 18th, 2006 | 2:59 am

    Anyone know how to create a Perl code for this?

  62. Warren H | January 19th, 2006 | 5:18 am

    Thank you for putting the logic together for this. Nicely done. I was dreading having to spend a few days putting this feature together myself and having to debug it (can’t stand forcing our clients to use the java applet). It seems you packaged it very well.

    I thought you might be interested that I found a minor bug in the logic and thought I would would give you the code change for the fix.

    When you choose multiple files from the dialogue box and a few of them are oversized files from your preset maxFileSize variable it will often allow the oversized files into the que for upload.

    Old code

    Main():
    uploadRefListener.onSelect
    			if (file.size/1024 > maxFileSize)
    			{
    				refList.fileList.splice (i, 1);
    					invalidFiles++;
    			};

    New Code:

    if ((file.size/1024 > maxFileSize) || (isNaN(file.size)))
    			{
    				refList.fileList.splice (i, 1);
    				i=i-1;			n=n-1;			invalidFiles++;
    			};

    evidently a NaN can be thrown after the firrst discovery of a large file for some of the other large files. This catches it.
    Also the original loop value of (i) would be too high to splice out multiple large files so I drop the values of (i) and (n) after each splice.

    Thanks again. Great work!

  63. steff | January 20th, 2006 | 4:01 pm

    Has anybody thought about security? I made an application which is password protected. After login the user can upload files. But how, can i pass the session to the flash without showing all the information in the sourcecode! Anybody a good idea or maybe working on the same problem?

  64. artur | January 21st, 2006 | 2:56 pm

    Does any body know the Server side script, if i use Appache Server with Oracle DB.(I need a code in PL/SQL)

  65. Michael Dowling | January 30th, 2006 | 12:11 am

    I get an HTTP 500 error when I try to upload files using the PHP code provided above. I CHMODed the directory to upload files and can’t figure out the problem. I can’t see uploaded files either.

  66. Onpa hyvinniin | February 8th, 2006 | 12:26 pm

    Hi!
    I have a problem with upload. Is it possible to get answer from “upload.php” -file during progress or together with onComplete to Flash?
    Like this:
    // file is uploaded and I want other information from php to flash…
    $answer = “Database updated” ;
    print(”&answer=$answer”) ;
    So if this is possible, how I can get it in flash?

  67. Davy | February 9th, 2006 | 9:57 am

    Nice functionality!
    Anyone allready made an ASP version?

  68. john | February 10th, 2006 | 1:35 pm

    I’m trying to use a site that uses flash and copy the sorce on it and I can’t could you please get back with me on if I need a program to view the sorce in flash. The only thing I can do is Print to file and I don’t know how what exstention to use when I print to file. Can someone please explain to me what i’m doing wronge or is there a program that I need to use to view sorce on flash sites. I do have flash 8 if that helps.
    Thank you for your time my email is above

  69. Davy | February 14th, 2006 | 10:47 am

    Finnally I’ve got the ASP version of the files here!

  70. Ossian | February 14th, 2006 | 5:14 pm

    John> Can I have a copy of the ASP files? :-)

    Thanks!!

  71. Davy | February 15th, 2006 | 8:59 am

    You can download the ASP files at Lolobal
    Gr. Davy

  72. Koen | February 15th, 2006 | 1:46 pm

    I download the files uploaded to my website in the wwwroot but if I upload a file I get a http 500 error

  73. Ossian | February 15th, 2006 | 10:18 pm

    Davy> Thanks! Got’em..

    However, im having problems using aspSmartUpload instead of aspUpload which costs money. Has anybody else tried that?

    Koen> Try to use the formTest.html file and upload from there. That way you might get a more precise error description. Internal server error could be path related.. Try skiping server.Mappath and use the full path instead.

    **********Allowed number of uploaded images**********

    Does anybody know how to limit the number of uploaded files in an upload session?? I.E. 30 at a time??

    Thanks in advance :-)

  74. Aaron | February 24th, 2006 | 2:01 pm

    Does anyone have advice for modifying the source code to allow multiple file select for downloads? Would this be an easy or complex change? (I’ve already modded the source for filetypes and size limits). It would really help for my application — I don’t need the image preview feature, but do need multiple select downloading.

  75. Slim | March 1st, 2006 | 6:35 pm

    Has anyone got this working in a J2EE environment? I’d like to get it working somehow with a Servlet. Any ideas?

  76. Buck | March 6th, 2006 | 7:42 pm

    I downloaded the source. I test it on iis i keep getting “error 405″ can anyone help with that

  77. Thim | March 8th, 2006 | 11:12 am

    Thank you very much 4 this excellent piece of code and functionality…

    We will use this 4 sure

  78. thummper | March 8th, 2006 | 10:46 pm

    THANKS! this looks very cool, and has been helpful as far as understanding whats going on with file uploads now. I’m using the cf version. Running into a http error 403. I browsed and someone on the MM forums had an non similar setup and issue, but was also getting 403 and pointed to articles reguarding phpsuexec and so, as instructed in the articles, I went and made sure all folders were max 755. Still no luck, and formTest.html gives me the error:

    Method Not Allowed
    The requested method POST is not allowed for the URL /uploadFile.cfm.

    Apache/1.3.33 Server at mydomain.com Port 80

    Any clues? i cant find anything about it anywhere.

    Thanks,
    -thummper

  79. Gabe | March 15th, 2006 | 4:38 pm

    Hi there, i have problems with the asp version i am using the aspSmartUpload but flash get an error called hhtpError 500. I am using iis and i have tried the aspSmartUpload form and it worked fine but with it gives me that error, any idea???

    thanks

  80. redbluevn | March 20th, 2006 | 3:01 pm

    Do you know how to compiler Flash in C#?
    Thanks

  81. Hello | March 22nd, 2006 | 3:53 pm

    google is the good search engine.

  82. kev | March 23rd, 2006 | 4:27 pm

    How do you get by sandbox security error when this is used by a macintosh client in various browsers.

  83. Patrick | March 30th, 2006 | 11:17 am

    Hi,

    I have downloaded the source and placed in on the web,
    I made the folder “userUploads” writeable for apache
    I don’t get any error’s bud uploaden dosn’t work.

    Do i forget something ?
    Is there an readme file somewhere ?

    Please help me with this one.

  84. Alex | April 26th, 2006 | 11:10 pm

    I need it for my shop.

  85. mojitomaker | May 9th, 2006 | 8:12 am

    can this be modified to work locally to pull in the URI of a local folder structure?

  86. Wayne Bienek - Web Design | May 9th, 2006 | 7:50 pm

    Easily the best I’ve found so far..

  87. Dislay | May 10th, 2006 | 2:04 pm

    ASP VERSION : i have an http 500 error and my file is not uploaded, did someone found the bug ?

  88. Sebastian Whittaker | May 21st, 2006 | 10:01 pm

    I had changed some coding around to accept media files and i am having issues refining the coding and getting it to work.. any suggestions?

  89. WebDever | May 30th, 2006 | 8:01 am

    The flash upload doesn’t show when the user is behind the proxy, but only in IE, in FF works fine. Any workaround with IE?

  90. Go_Beyond | May 31st, 2006 | 4:58 pm

    I’m getting “Unexpected File Format” when trying to open the fla. I’m using MX2004. Please help!!!

  91. SL | May 31st, 2006 | 10:50 pm

    Has anyone figured out the ASP functionality? I am getting the following error:

    Persits.Upload.1 error ‘800a003d’

    Wrong Content-Type. Make sure you have included the attribute ENCTYPE=”multipart/form-data” in your form.

  92. balage.technoart | June 2nd, 2006 | 10:32 am

    hi,
    don’t you know is there any solution for the ‘big’ file upload bug? (when you want to upload file about 20mega the player gets unstable, and open the ’script run too slowly’ alert window).
    I hoped that it will be changed in the player 9, but unfortunatelly not :-(
    still doesnt work well (player 9 with ie6)

    it’s a shame, but if it still doesnt work, we must go back to the simple html+javascript upload :-(

    thx,
    balage,
    balage@technoart.hu

  93. war.makina | June 5th, 2006 | 10:10 am

    ei guys i have posted it in the forums, il just repost it again here and hope som1 cud help me..

    -in the website example, before someone can download the images, there must be a user login verification.. how can i do that? is there also a way to have a verification b4 someone can upload a file?
    -is it also possible to place all uploaded files in an ftp server? coz i have noticed in our server that the userUploads can be viewed by anyone.. huhu:D im planning to make it more private and secure.
    -i have set the maximum file size to 10mb and yet the upload tool only upload files which are less than 1mb.. is apache server configuration concern in this matter?

  94. war.makina | June 7th, 2006 | 1:31 am

    ei guys, i have figured out some of my questions.. tnx for the replies anyways.. well can this flash object support drag and drop capability. for example i have a file on my desktop then i will drag these files and drop it on the upload window..

  95. war.makina | June 7th, 2006 | 9:44 am

    can i do multiple downloads for the files i have chose? and then create a zip file..

  96. Jess | June 9th, 2006 | 1:04 pm

    Been reading comments on how to get a message back to Flash from the PHP to say when the file has uploaded properly (or not). I had this resopnse from a forum I posted my question on - Have a look in livedocs
    http://livedocs.macromedia.com/flas…art4_ASLR2.html
    actionscript 2.0 language reference->actionscript classes->FileReference->onComplete (towards the end a couple posts regarding returning customised http errors)
    you can return certain rarely used http codes to indicate certain states in conjunction with onHTTPError.
    I’m using this now and its very useful!

  97. sarah | June 12th, 2006 | 3:23 pm

    This is a really great resource; thank you for making it available. I’m semi-flash-ignorant, and trying to figure out how to use this file and a) pass a variable (an “uploadId”) to php so i can update the database once the file is uploaded and b) send user to a different URL after the file is uploaded. Can anyone give me some guidance? Thanks. /skc

  98. strotti | June 16th, 2006 | 9:27 pm

    Hello,

    i found this script two days ago and i already installed it on my server. Meanwhile, with the php version is very easy to bypass the prohibited files. Malicious people could send executables scripts to the server and then execute them remotely. In fact, even if you filter the extensions, once you want to upload a file, you click on “browse” and then you won’t see your malicious script because it will have a prohibited extension. But, if you give the name in the “file name” field, the forbidden file will appear into the “upload” window and then you can upload it. It will bypass the “allowed extensions”. Then, if the directory is marked as “script executable”, the bad guy can call his script which will execute on the victim’s server. I would like to know if somebody has already a workaround for the php scripts, which will check by itself the allowed extensions before sending them to the server.

    Thanks for reading.

    Strotti

  99. Blaine Garrett | June 21st, 2006 | 6:39 pm

    Can flash read files in a directory?

    I would like to make a photo uploader that allows the user to choose a local folder and then it displays thumbnails of the photos and allows the user to choose which ones they want to upload. I have seen this done in Java, but I don’t really want to work in java if at all possible.

    I guess basically, I am trying to get around the whole “operating system” open dialog box for the FileReference feature. Any thoughts?

  100. btremote | June 27th, 2006 | 12:45 am

    Hi People,

    Going through all the information on this page, is starting to make my head hurt. It seems like it is about time that some-one compiles all of this, and starts a clean thread, or provides an updated version of fileuploaddownload..?

    What do you think?

    There are too many questions, and not enough answers…

  101. Mentep | July 19th, 2006 | 6:16 am

    Hi,

    Tried to download the source file but your link is dead. How can I get the source file?

    Thanks

  102. Tom Green | August 6th, 2006 | 1:31 pm

    Nice site. I had a bit of trouble with loading some of the pages, but maybe that’s just because I use a non-standard browser.
    http://phentermineaad.blogspot.com/  Warm regards Tom Green!

  103. Csaba Petre | September 4th, 2006 | 1:05 am

    I am wondering if it would be possible to provide an updated link to the source files, since the original links are dead. Thanks.

  104. Brajeshwar | September 4th, 2006 | 9:28 am

    CSABA, I have provided a BackUp download link above, btw, the demo is not working as I’m unable to foot the bill for hosting just for this one. I’m though planning to move it to one of our server though (it was alone on a virtual dedicated server).

  105. Kurt Granroth | September 6th, 2006 | 6:32 am

    “The current demo have a parameter to control the MAX size of the individual files that can be uploaded”

    thank you for telling me this!

  106. LEE Fernandes | February 8th, 2007 | 6:03 am

    I can confirm the download links are not available.

  107. Tadas | February 8th, 2007 | 6:32 pm

    Hi, i need the source file. It is very important. Please update the link. Thanx.

  108. Alex Egg | February 24th, 2007 | 2:14 am

    Here’s the C# code if your backend is asp.net instead of PHP:

      HttpFileCollection files = Request.Files;

      System.IO.BinaryReader br = new System.IO.BinaryReader(files0.InputStream);
    byte[] bytes = new byte[Convert.ToInt32];
    bytes = br.ReadBytes(Convert.ToInt32);
    string fn = files0.FileName;
    string path = Server.MapPath(”uploads”) “\\” fn;
    FileStream fs = new FileStream(path, FileMode.Create);
    fs.Write(bytes,0, bytes.Length);
    fs.Close();

  109. Jasmin | March 29th, 2007 | 8:18 am

    I download the php code but I have problem upload. After the upload is complete when I check the file there was no file that I upload. Can you help me to solve this porblem.

  110. Oliver | April 8th, 2007 | 4:52 pm

    Hi,

    When opening the .fla file in Flash 6.0 I get a error saying: “unexpected file format”

    Any help would be greatly appreciated.

  111. Oliver | April 8th, 2007 | 4:53 pm

    Is there a way that the content that is written to the page only shows the upload pane and not the donwload pane?

    I just want to have the upload pane visiable and operational.

    Also is there a way to know how many files are being submitted by the upload textarea so that you can loop through them?

  112. Brajeshwar | April 8th, 2007 | 5:39 pm

    Flash Player 6 have no support for FileReference and thus it was not an FLA created during the Flash 6 days!

  113. Oliver | April 10th, 2007 | 3:41 am

    I also tried to view the fla in Flash 5 but I still get the same error: “unexpected file formatâ€

    Is the file corrupted?

    regards
    oliver

  114. kalai | April 12th, 2007 | 2:08 pm

    Hi,

    I’ve an issue. I’ve a flash uploader to upload multiple files(pdf, doc) to a folder in the server.The upload is working fine. I want to download the files to my desktop using the core http://ftp. But, I see the permission of the folder as 600 and I cannot download them to my pc either. So what’s wrong and how to fix it??

  115. Brajeshwar | April 12th, 2007 | 5:52 pm

    @Kalai - I think you have said the answer yourself. It is an FTP issue and flash or this file upload/download module have nothing to do with it.

  116. kalai | April 13th, 2007 | 11:54 am

    Yep, I agree, now am fiddling with ways to change the file permission in php, i.e after uploading the file to the specifica folder with 777 permission, am trying to change the permissions of the files to 777..
    Still no luck.. let me see..

    Anyway thanks for the responding

  117. John | May 8th, 2007 | 7:00 pm

    I ran into the same problem with the sessions not being passed and came up with a solution that I’ve posted.

    My solution is in Rails, but should be similar with other web frameworks, you can find it here:
    http://blog.overlay.tv/articles/2007/05/07/flex-2-file-upload/

  118. kalai | May 9th, 2007 | 10:22 am

    Hi,

    Well, I was able to ix the ftp issue, what I’ve to do, is call the chmod command for the files being uploaded. chmod ($uploadFile, 0777);
    That’s it…

    but now i face one more issue. I just want to list the files (SORTED - either date or name) in the rich file upload - destination folder (tree view component). Is there any way to achieve this?

    Thanks

  119. Jason | May 24th, 2007 | 12:11 am

    My implementation of this is working flawlessly in IE but it’s not working in Firefox… I have done what the prior poster suggested which is “substitute the javascript for HTML using param=flashvars”. I am embedding with embed and param tags, no JS.

    In firefox when i try to upload the progress bar goes all the way up as if it’s transferring but the files never appear on the server. When i try to download I get a flash dialog window “An IOError occured.” 

    Does anyone know what the problem might be?

  120. John | May 24th, 2007 | 1:16 am

    Jason: check out my post above and the article I link to (post 117). In firefox the flash file upload gets a separate session from all the other requests, which is what was causing my troubles.

    Not sure if you’re having the same problems, but if you are check out that article because I have a solution in there.

    Hope that helps.

  121. romeo | July 24th, 2007 | 2:49 pm

    Thanks Alex for your c# code, it helps me a lot with Flex.

  122. Cvetik | October 7th, 2007 | 9:26 pm

    The URL in FileReference.upload(url.php) does not recognize $_SESSION variables (always undefined even when the session is set) – anyone else experience this or have a solution?

  123. Rafael Souza | June 21st, 2008 | 12:44 am

    To solve session issue in PHP I dont call session_start() in script that process upload request, so to you keep your script safe, make another security check, with a hash for instance

  124. ROBERT | October 10th, 2008 | 7:54 pm

    Please, I have the same problem with 1MB limit, even though the web.config (ASP.NET) is set to much higher (and besides, the default is 4MB).

    I’ve managed to determine that if the file is bigger than 1MB the upload script isn’t even run at all. It is only run if the file is below 1MB.

    Anybody have an answer for this?

  125. ROBERT | October 13th, 2008 | 12:32 pm

    Hehe… Time heals all wounds. I found the answer.

    I’d configured error handling in Global.asax, and it normally redirects to an error page, but in this case, obviously, the only “one” who would see this error page would be the flash app, and it was satisfied with the execution of this page, so hence, no error, no (visible) redirect, just no file.

    Fixed.

Post a comment