views:

1734

answers:

5

Is there a way to have an file browser for Flash that allows the user to browse their local machine, view thumbnails of jpgs and other images and upload selected files? This would be like the ActiveX/Java applet that Facebook uses. Any ideas or examples? Thanks!

A: 

Adobe AIR should be able to do this. By putting the Flash in the AIR "container" it should have more rights than a normal Flash app would have.
Adobe AIR

Not sure if you can do it from Flash in the browser.

The Facebook things is Java. So Java can do it.

Silverlight might be able to do it. Not sure.

tyndall
I think I have seen some other questions like this on StackOverflow. Make sure to look those up too.
tyndall
+3  A: 

You can use a FileReference object, which allows the user to browse his filesystem (it pops up the native OS UI control, so if what you want is making the file browser itself, I'm afraid it's not possible, at least in normal swf).

In flash player 10, you can work with local files directly; load the file into the swf, modify it and save it back (it requires user interaction, i.e. a mouse click, and again, it pops up a "save file" native dialog; you can't write the file directly for security reasons). For previous versions, you have to upload the file to a server first and then download it back to be able to modify it.

Juan Pablo Califano
A: 

To answer your question, unfortunately you can't specifically replicate the functionality of the Facebook image-upload control purely in a browser-embedded SWF, no -- there's just no Actionscript API allowing direct access to the filesystem from within a Web browser.

Both posters are correct, but on different points -- AIR can do it (under certain restrictions, with flash.filesystem.File), and you can browse to (with a native OS file-selection dialog, with flash.net.FileReference), select and upload one or more files to a Web server -- but in a Web browser working within the confines of the Flash player plug-in, it's just not possible to enumerate the contents of a local directory and display thumbnail imagery in this way. Not with Flash alone. (Or even Silverlight, for that matter.)

Sorry, I wish I had a better answer for ya. Java still looks like the most reasonable option, if the app needs to be Web-based. You might also look into JavaFX, though -- I haven't used it myself yet, but it might offer something the other two don't. Best of luck.

Christian Nunciato
A: 

You could try using HippoHX to build a restriction-free desktop application with a flash frontend/GUI. It uses Neko for a small system layer application, which has full access to all system resources. As far as I know there is no solution to do this directly in the browser, accept using Java.

Hippo
A: 

After reading Juan's answer I'm wondering can we index local files using Flash? Especially MP3s?