Is there publicly available actionscript which browses a hard disk from a flash page?
December 6, 2004 3:18 AM   Subscribe

Browsing the hard disk from a flash webpage.
a) is it possible?
(I know it is - i've seen a component that does it. But i want the actionscript that does it)
b) help
(i just need some pointers - tutorials, actionscript snippets and so on)

AHA - it seems that the component i was refering to in my question actually just placed an invisible html-submit-button over the flash-movie - using some far out java-script.

I don't like that sollution one bit. Help me do it another way.
posted by FidelDonson to Computers & Internet (13 answers total)
 
You can't. Flash has virtually no ties to the local file system, for good reason.
posted by cheaily at 4:54 AM on December 6, 2004


I second cheaily, it simply isn't possible to browse a local hard disc via Actionscript (thankfully!). Perhaps you could provide more detail on exactly what it is you are trying to achieve?
posted by bruceyeah at 5:56 AM on December 6, 2004


You'd have to use some sort of server-side system. Like ASP's filesystemobject
posted by derbs at 6:06 AM on December 6, 2004


Browsing the hard disk to what end? Do you want the user to be able to navigate throught their hard drive, or do you want the Flash app to be able to? Are you looking for the user to be able to upload/download a file?

Also, the Flash message boards run by Macromedia are an amazing place to get answers. The people who read and respond to messages there, including Colin Moock, are some of the best in the business.
posted by spaghetti at 7:03 AM on December 6, 2004


If you figure out how do this (assuming "this" means local access to the filesystem from a binary on a remote web server) I'm removing the Flash plugin from every machine in my control at home and several hundred more at work. Remotely loaded code should be sandboxed, and if Macromedia isn't doing that it would be very, very bad.
posted by majick at 7:19 AM on December 6, 2004


Is this for a Submit File type of situation that you can do with a form in HTML for people to upload files to a server?

Flash run outside of a web page as an executable, with projector wrappers from various companies can do this, but it might be helpful to define, as others have said, what the purpose of browsing the HD is.
posted by juiceCake at 7:42 AM on December 6, 2004


It'd be pretty simple, actually. Use a PHP script to return the directory in a long-ass variable string in Actionscript. I can give you specifics if you're interested.
posted by Civil_Disobedient at 10:17 AM on December 6, 2004


majick: i spent 4 hours trying to figure out how to do it. you can't. macromedia's got flash locked up tighter than a duck's butt.
posted by cheaily at 3:11 PM on December 6, 2004


Did I stutter? It CAN be done, and VERY easily.
posted by Civil_Disobedient at 4:02 PM on December 6, 2004


Yeah it can be done, but only on a server that you've got access to, one that has php or asp or perl installed... there's no way a flash movie can access a local file system.
posted by derbs at 4:26 PM on December 6, 2004


Two files: READDIR.PHP and READ.SWF

READDIR.PHP
---
<?
$rep = "thefolderinquestion/";
$dir = opendir($rep);
$x=0;

while ($f = readdir($dir)) {
   if(is_file($rep.$f)) {
      echo "&file" . $x . $f;
      $x++;
   }
}

echo "&filecount=" . $x . "&finished=true"; ?>

READ.SWF
---
FRAME 1:
---
loadVariablesNum ("readdir.php", 0, "GET");

FRAME 2:
if (_root.finished eq "TRUE") {
   gotoAndStop (4);
}

FRAME 3:
   gotoAndPlay(3);

FRAME 4:
At this point, the variables are all loaded. If you want to create an array for later use, you can loop through the files like this:

myarray = [];
for (i=0;i <=_root.filecount; i++) {
   myarray[i] = eval("_root.file" & i);
}

Now all the files are in a handy-dandy array.

There may be some syntax errors or typos in there -- I just reinstalled my OS and don't have Flash installed yet, but that's the basic method.
posted by Civil_Disobedient at 4:28 PM on December 6, 2004


Yeah it can be done, but only on a server that you've got access to, one that has php or asp or perl installed... there's no way a flash movie can access a local file system.

There was no mention of not being able to use a script to grab the variables. But yes, Flash cannot natively read the file system, even if it's a local machine.
posted by Civil_Disobedient at 4:29 PM on December 6, 2004


Already spotted one type. In the PHP script, it should be:

echo "&file" . $x . "=" . $f;
posted by Civil_Disobedient at 4:32 PM on December 6, 2004


« Older Great American Dream Machine nostalgia   |   Friend with a Drinking and Driving Problem Newer »
This thread is closed to new comments.