|
|||
|
hi there! got another issue, tried looking at swfKIT help but havent found anything that you could actually browse a file to copy instead of a folder. any ideas would be appreciated.
thank you ![]()
__________________
canned_tooth |
|
|||
|
thanks for the reply and it browse for the file. anyway, been working around it cause i need to do is to get the path of the file to browse and copy it to a different directory. this is how i do it and i cant make it work.
var copyThis = FlashPlayer.getVariable("_root.copyThis"); while (copyThis.search("/") >= 0) copyThis = copyThis.replace("/", "\\"); var file = new File(copyThis); return file.copy("c:\\DirectoryName\\"+file.name) thanks!
__________________
canned_tooth |
|
|||
|
Quote:
__________________
canned_tooth |
|
|||
|
Why not just try this:
Code:
//Opens FileOpen Dialog
var lookforwhat = "Some File (*.*)|*.*|";
var filetoload = Dialogs.fileOpen(lookforwhat, "", "", false);
//Checks to see if a file was selected and if it exists, then sets to Flash the location of it to the variable _root.location
if((filetoload!=false) && (File.exists(filetoload))){
FlashPlayer.setVariable("_root.location",filetoload);
//Next, get the name of the file
var nameoffile = new File(filetoload);
filetoload = nameoffile.name;
FlashPlayer.setVariable("_root.filename",filetoload);
} //end of if((filetoload!=fal...
//Now, get the location and filename from the Flash file and uses a new location you give it
filename = FlashPlayer.getVariable("_root.filename");
location = FlashPlayer.getVariable("_root.location");
newlocation = "C:\\Documents and Settings\\"+filename;
//Copy the file from the location to the new location
if(File.exists(location)) (new File(location)).copy(newlocation);
//Slight Note: Test to make sure the C:\\Documents and Settings\\ actually works.
|
|
|||
|
Quote:
newlocation = "..\\"+filename; ===================== i tried using newlocation = filename; and it copied the file in the source folder ( like if i copy file.pdf in c:\\myPDFs, the copy goes in there too). hoping for answers.
__________________
canned_tooth |
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|