The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Download Folder/PDFs
#1
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
  Reply
#2
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/15774...ectory-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.
  Reply
#3
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
  Reply
#4
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.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)