...

View Full Version : Simple way to open an OPEN dialog box?



CaptainMench
06-14-2006, 06:07 AM
I want a dialog box to open so I can open a file direct... In Javascript I'd type:

var pfile = fileGetDialog("Select a file.", "TEXT");

if (pfile == null){
alert("No file selected. ");
}else{



var readData = pfile.open("r","TEXT", "????");
if(readData){
var encoded_data = pfile.read();
}else{
alert("Problems reading file");
}

Break... (sorry, don't know how to enter code boxes yet)

There's an easy way to do this in PHP, yes?

Thanks...

CaptM

ralph l mayo
06-14-2006, 06:19 AM
The easy way to do this in PHP is do to do it in JavaScript, since PHP is a server side language and would be more inclined to pop up dialogs on the host box than over the web. Either echo a <script> block or an include to a standalone javascript file.

CaptainMench
06-14-2006, 02:24 PM
Ralph --

Thanks. Honestly, I'm over my head here. Let me know if what I'm asking is impossible at this point...

I've coded a PHP script to run on my own computer using Apache/PHP5 to parse data out of an XML into a JSON data file so that it can be read and used by a Javascript in another program. This isn't really a web based app for public consumption over the net.

Right now, I have to hardcode the XML data file name into the PHP script (which right now I have to keep both XML and PHP script in my MAMP/bin/mamp folder)... which includes going into BBEdit and changing it each time I want to parse a different document... since I couldn't figure out how to parse the xml straight into the javascript -- which might be my downfall in this anyway.

I do have another problem if you're willing to help with that too...

I don't have the code infront of me, but I echo it at the end and the data comes back up on my browser which I then copy and paste back into BBEdit and save as a .php doc for import by the Javascript I've got... any way to echo that to a .php doc just by coding it?

Thanks,

CaptM



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum