CodeIgniter Forums
How to list files from user desktop or any drive in browser - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: How to list files from user desktop or any drive in browser (/thread-10605.html)



How to list files from user desktop or any drive in browser - El Forum - 08-06-2008

[eluser]manish[/eluser]
I want to display list of file form user local machine.
Could anybody have idea how to do it?

Thanks in advance


How to list files from user desktop or any drive in browser - El Forum - 08-08-2008

[eluser]ontguy[/eluser]
The file helper maybe what you're looking for: http://ellislab.com/codeigniter/user-guide/helpers/file_helper.html

Code:
get_dir_file_info('path/to/directory/')

Reads the specified directory and builds an array containing the filenames, filesize, dates, and permissions. Any sub-folders contained within the specified path are read as well.


How to list files from user desktop or any drive in browser - El Forum - 08-09-2008

[eluser]tix[/eluser]
Thats not to be done on server side but on client side.
You could use flash,flex or java but the user has to allow it to access his files.


How to list files from user desktop or any drive in browser - El Forum - 08-11-2008

[eluser]manish[/eluser]
Thanks for reply, yes I also looking for best client side options.
Could you please provide me any link where I will get information how to implement it on client side ?

Thanks...


How to list files from user desktop or any drive in browser - El Forum - 08-11-2008

[eluser]yelirekim[/eluser]
I think you're making your problem a lot more complicated than it needs to be.

You don't need to code anything in javascript or flash or anything like that in order to get a user to select and upload a file, all of this stuff is taken care of automatically by every major browser for all HTML specifications, you just need to use an file input on any standard (X)HTML form and it will create a browse button, and associated pop-up dialog for file selection, for you.

Try putting this code on a page and viewing it in a browser, see what happens.

Code:
<form action="file_upload.php" method="post" enctype="multipart/form-data">
<input type="file" name="uploadFile">
<input type="submit" value="upload">
</form>



How to list files from user desktop or any drive in browser - El Forum - 08-11-2008

[eluser]manish[/eluser]
Thanks,

Yes i know it's good option and easy But i need to show list of file on user desktop or from any other drive.
Is there any easy way ............


How to list files from user desktop or any drive in browser - El Forum - 08-11-2008

[eluser]yelirekim[/eluser]
You want to display a list of the files on a user's desktop, on a webpage? You can't do this, at least not without some kind of external plugin.

Two reasons for this:
1. it's invasive and a security issue to grant webpages you go to access to information about your computer's filesystem, it was decided long ago that web browsers would not support this kind of functionality.
2. even if this weren't the case, you have no way of telling what kind of OS the person is using, they might not even have a 'desktop', what if they are using an iPhone to access your site?

You're really talking about creating a hybrid desktop / browser application, I'd look into technologies like adobe flex or google gears.


How to list files from user desktop or any drive in browser - El Forum - 08-11-2008

[eluser]Colin Williams[/eluser]
Quote:Is there any easy way[?]

With old browsers running ActiveX, maybe. But thank god there isn't an easy way. Your best bet is going to be providing a downloadable executable that the user installs and runs, probably running on Java.