The following warnings occurred: | ||||||||||||
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
|
Download Folder/PDFs - Printable Version +- UserSpice (https://userspice.com/forums) +-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23) +--- Forum: UserSpice 4.3 and Below (https://userspice.com/forums/forumdisplay.php?fid=26) +--- Thread: Download Folder/PDFs (/showthread.php?tid=207) |
Download Folder/PDFs - sbarbee - 08-18-2016 I want to give users access to a folder containing .pdf's, simply called 'downloads'. I have added 'downloads/' to the z_us_root.php file. Do all the files need to be .php to work? Sorry for my ignorance with this part. I can tell that the folder is working, I copied the 'empty.php' file to downloads/, and it's visible and accessible. Any suggestions? Thanks! SB Download Folder/PDFs - mudmin - 08-18-2016 Userspice is primarily designed to control access to PHP files, but that doesn't mean it can't help. Essentially what you want to do is to create a new page called userfiles.php or whatever you want to call it. Once you go into "manage pages" in the admin panel, that page will be controllable by userspice, so you can decide who has access to it. THEN you basically want that userfiles.php to retrieve a list of files in a directory and turn them into links. There is a php command called scandir. It is explained in the bottom answer to this question. http://stackoverflow.com/questions/15774669/list-all-files-in-one-directory-php Once you have that variable $files, it's probably pretty easy to do a foreach loop and turn each of those filenames into a link. I hope that helps. Download Folder/PDFs - sbarbee - 08-18-2016 Excellent! Thank you! That will work just fine. I'm a bit inexperienced with php - and I new there'd be a way. I'm really enjoying UserSpice, btw. Great product! SB Download Folder/PDFs - mudmin - 08-18-2016 Glad you're enjoying it...It's really cool to see all the different things people are doing with it. If there's anything I can do to help, let me know. |