Home › Forums › Quform PHP › Custom folder name when uploading files to server
- This topic has 4 replies, 2 voices, and was last updated 7 years, 9 months ago by eklem2009.
- AuthorPosts
- January 11, 2017 at 12:29 pm #20626eklem2009Participant
Hi,
I’ve been using QuForm for a while now and love it, however, I now have the need to upload files and store them on the web server.
This is working fine, however, I’m embedding it into a login-restricted environment and would like the upload to be put into a personal folder for the logged in use.
This seems pretty straight forward with something like the code below but I’m not 100% sure what it needs to be:
$config[‘uploadPath’] = QUFORM_ROOT . ‘../../content/ . $_SESSION[‘username’] . /uploads’;
Any help would be greatly appreciated!
January 12, 2017 at 11:53 am #20631AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
January 12, 2017 at 12:34 pm #20633eklem2009ParticipantHi Ally,
Thanks for your reply. I think the issue lies in the session/username not getting passed to Quform and I’m not sure how to do this correctly without causing a conflict.
I figured an alternative way to pass the username would be to use a hidden field within the form like:
<input type="hidden" name="userfolder" value="<?=$_SESSION['username'];?>"/>
I’ve tried something like this but I think I’m coming at it from the wrong way:
$userfolder = new Quform_Element('userfolder'); $config['uploadPath'] = realpath(QUFORM_ROOT . '/../../content/'.$userfolder.'/uploads');
January 12, 2017 at 1:49 pm #20634AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
February 1, 2017 at 1:52 pm #20742eklem2009ParticipantThanks Ally, that worked perfectly!
- AuthorPosts
- You must be logged in to reply to this topic.