You'd think that it would be an easy thing to do since choosing a file on the local system and uploading it to the server is perspicaciously accomplished in html with a form containing <input type='file'> that posts to a php/asp/jsp script, which finally copies the file to the sever. I am not going to cover the later in this tutorial, if you need help with file copy to the server, send a note, I can tell you how using php.
At
http://www.yamago.net/components/ you can download a component (thx jorge) that will allow you to browse the local file system via your web browser's file locator pop-up window. Yamago accomplishes this feat with a quite complex script that hovers a hidden div that contains a <input type='file'> over the flash button labeled 'browse'. It is really neat but extraneously complex.
Here's another approach, tested only in IE6 and NS7.1 (mozzilla 1.3), I believe that mozzilla 1.2 will not allow variable passing to flash via swLiveConnect, I digress, anyway:
1) In the flash movie, make a buttton with:
on(release){
fscommand("","");
//fscommand needs to have two parameters,
//you can leave them empty here though
}
And create an input or dynamic field and give it a value for var, such as 'flashVar'
Make sure that your publish settings are set to 'Flash with fscommand', publish the movie and use the code that flash generates to allow the fscommand call to work with IE as well as Netscape.
2) Let's say you published the movie with the file name myMovie, there will be a function generated:
function myMoive_DoFSCommand(command, args) {
var fstestObj = InternetExplorer ? fstest : document.fstest;
//
b = window.open('browse.html','browse','height=55,width=300,left=200,top=200');
b.focus();
//add these lines of code to the script
//
//
}
Add this function to the script:
function setFlashVar(value){
window.document.myMovie.SetVariable("flashVar", value);
}
3) Create an html file called browse.html and include the following within the body tag:
<SCRIPT LANGUAGE=JavaScript>
<!--
function setFlash(value){
window.opener.setFlashValue(value);
window.close();
}
</script>
<input type="file" size="30" onChange="setFlash(this.value)">
That's it! Hopes it works out for you, enjoy! You can see an example at:
http://www.hallwaymedia.com/file-browse-flash-javascript/