Custom folder name when uploading files to server

Home Forums Quform PHP Custom folder name when uploading files to server

This topic is: resolved
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #20626
    eklem2009
    Participant

    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!

    #20631
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #20633
    eklem2009
    Participant

    Hi 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'); 
    #20634
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #20742
    eklem2009
    Participant

    Thanks Ally, that worked perfectly!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy