Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jun 2006
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Simple way to open an OPEN dialog box?

    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

  • #2
    Regular Coder ralph l mayo's Avatar
    Join Date
    Nov 2005
    Posts
    951
    Thanks
    1
    Thanked 31 Times in 29 Posts
    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.

  • #3
    New to the CF scene
    Join Date
    Jun 2006
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •