A JM Posted June 23, 2009 Share Posted June 23, 2009 I'm looking for some suggestions for allowing my users to view and download files from my site. The files are contained in a single directory and I would like to allow the user to view a list of files in that directory and then be able to select them for downloading, singularly. Anyone have any suggestions for the best way to present this to the user? Thanks. A JM, Quote Link to comment https://forums.phpfreaks.com/topic/163407-suggestion-for-displaying-files/ Share on other sites More sharing options...
flyhoney Posted June 23, 2009 Share Posted June 23, 2009 lolz, just let them go to the directory in their browser, right click, "Save Target As". Done. Or you could use something like this: http://thefilebrowser.com/ What kind of files are they? Quote Link to comment https://forums.phpfreaks.com/topic/163407-suggestion-for-displaying-files/#findComment-862149 Share on other sites More sharing options...
A JM Posted June 23, 2009 Author Share Posted June 23, 2009 They are .xls, .doc and maybe some images. I'm looking for the best way to display them on an HTML page. Should I just create a hyperlink to each file and move on... just looking for some ideas. Thanks, Quote Link to comment https://forums.phpfreaks.com/topic/163407-suggestion-for-displaying-files/#findComment-862161 Share on other sites More sharing options...
Alex Posted June 23, 2009 Share Posted June 23, 2009 Just loop through the directory and display all the files with a link. $path = 'some path here'; $dir = dir($path); while($file = $dir->read()) { echo $file . ' - <a href="' . $path . $file . '">' . $file . '</a>'; } Quote Link to comment https://forums.phpfreaks.com/topic/163407-suggestion-for-displaying-files/#findComment-862165 Share on other sites More sharing options...
A JM Posted June 24, 2009 Author Share Posted June 24, 2009 Thanks for the ideas. A JM, Quote Link to comment https://forums.phpfreaks.com/topic/163407-suggestion-for-displaying-files/#findComment-862541 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.