SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Zealot darksystem's Avatar
    Join Date
    Jan 2005
    Location
    Fayettville, North Carolina
    Posts
    184
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to display local files using Javascript/PHP

    Hello,

    I was wondering if there's a opensource script that displays localfiles
    using Javascript or PHP. Any help would be much appreciated.

    regards,
    Mark
    Ebay API, OSC/CRE/OscMax/ZenCart/SEO Services
    Lucki Multimedia - Email

  2. #2
    SitePoint Addict
    Join Date
    Jul 2006
    Location
    Kansas City, MO
    Posts
    280
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    local to the client or the server? cause javascript is clientside and php is serverside...

  3. #3
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,161
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)

    file listing

    PHP's file system functions can be used to access and dislpay the files on your server. For your local machine you could use an input type=file to call up the file browser. Or, I'm sure there is a way to use js (or vbscript) to call up the ActiveX control if you have a Windows OS

  4. #4
    SitePoint Zealot darksystem's Avatar
    Join Date
    Jan 2005
    Location
    Fayettville, North Carolina
    Posts
    184
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Local files(my local pc). Here's what I mean.

    I want to have a javascript/php script(located on the server) that can display my local files once I visit the site(server). I know how to display local files using PHP if my server is in my local pc. But my problem is what if the php script is in the server(which is located in UK). I am building an ajax/php based ftp that can display both server files and local files and has dragable feature to transfer local files to server. But I cant figure out how to do that. I think I need a lot of time to do this. I hope somebody could help me where to find that script that can display local files. Any help is very much appreciated.
    Ebay API, OSC/CRE/OscMax/ZenCart/SEO Services
    Lucki Multimedia - Email

  5. #5
    SitePoint Zealot darksystem's Avatar
    Join Date
    Jan 2005
    Location
    Fayettville, North Carolina
    Posts
    184
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For your local machine you could use an input type=file to call up the file browser
    Yeah you're right if its a single file only but I am adding
    a feature that can upload the entire folder and can select
    2 or more files to be uploaded in the server. To make it short
    just like the file transfer of cuteftp. My hair is almost out
    on how to figure out this. Maybe you know some opensource
    that I could use on this. Any help would be much appreciated.
    Ebay API, OSC/CRE/OscMax/ZenCart/SEO Services
    Lucki Multimedia - Email

  6. #6
    Resident Code Monkey Chris Corbyn's Avatar
    Join Date
    Nov 2005
    Location
    Melbourne, Australia
    Posts
    713
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can do it with an IFrame. What do you need it for?

  7. #7
    SitePoint Zealot darksystem's Avatar
    Join Date
    Jan 2005
    Location
    Fayettville, North Carolina
    Posts
    184
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by d11wtq
    You can do it with an IFrame. What do you need it for?
    I think that will not work. What I am after is a script(server) that can display
    my local files(my pc). If there's a javascript/phpscript that can do that then
    I will be the one to do the transfer ability.
    Ebay API, OSC/CRE/OscMax/ZenCart/SEO Services
    Lucki Multimedia - Email

  8. #8
    SitePoint Evangelist Jedi007's Avatar
    Join Date
    Aug 2005
    Posts
    463
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    php can't display local(my pc) files, otherwise that would be spying in a way. JavaScript can probably do it, probably vbs also, but php can't...

  9. #9
    SitePoint Member
    Join Date
    Dec 2006
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know if this is what your looking for but if you want a script that displays files in a directory take a look.
    Code:
    <?
    $dir = "path/to/directory";
    if(is_dir($dir)){
    if($open = opendir($dir)){
    while(($file = readdir($open)) !==false){
    echo "<a href=".$file.">".$file."</a><br/>";
    }
    }
    }
    else{
    echo $dir." Was not found";
    }
    ?>
    Something like that should work, i learned it a few months ago while looking up a function.

    Edit: Ah, I understand what your looking for now. I don't think this will display local files on your pc.

  10. #10
    SitePoint Zealot darksystem's Avatar
    Join Date
    Jan 2005
    Location
    Fayettville, North Carolina
    Posts
    184
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yeah you got it. that wont display local files.

    I tried to make a javascript that will display a moment ago but no luck yet and my hair is almost out. I hope somebody will help me to figure out.
    Ebay API, OSC/CRE/OscMax/ZenCart/SEO Services
    Lucki Multimedia - Email

  11. #11
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,161
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)

    directory viewer

    I don't think javascript alone can work with the OS. If this is for your use only or maybe an intranet then you should be able to put something together (a script that works with native ActiveX controls, or a custom ActiveX control or Applet ?). But if this is for site users you should weigh any benefit from the enhanced functionality against the requirement to download a helper. Maybe these links will help?
    http://www.codeguru.com/cpp/controls...icle.php/c737/
    http://doc.trolltech.com/3.3/dirview-example.html

  12. #12
    SitePoint Zealot darksystem's Avatar
    Join Date
    Jan 2005
    Location
    Fayettville, North Carolina
    Posts
    184
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think a java applet would be fit, I guess. I have to give it a try first.
    Ebay API, OSC/CRE/OscMax/ZenCart/SEO Services
    Lucki Multimedia - Email


Bookmarks

Posting Permissions

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