Multiple Upload file paths

Home Forums Quform WordPress Multiple Upload file paths

This topic is: not resolved
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #17764
    patdundee
    Participant

    Hi Guys can the following code be changed for different forms ids with various upload files

    Example form 1 has 4 upload files 2 files go to one folder and 2 files go to a different folder. Thus giving us control over all file uploads to different directories for different upload files on different forms.


    add_filter('iphorm_upload_path', 'my_upload_path');
    function my_upload_path()
    {
    return '';
    }

    Many thanks
    Patrick

    #17798
    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.

    #17800
    patdundee
    Participant

    Ah

    So I can also change the form ID as well as the element id to work with different forms? For eaxmple I could do this for form 1

    
    function my_upload_path_1($path, $element)
    {
        $name = $element->getName();
    
        if ($name == 'iphorm_1_1' || $name == 'iphorm_1_2') {
            $path = 'some/other/path/';
        }
    
        return $path;
    }
    add_filter('iphorm_upload_path_1', 'my_upload_path_1', 10, 2);
    

    And this for form 3

    
    function my_upload_path_3($path, $element)
    {
        $name = $element->getName();
    
        if ($name == 'iphorm_3_5' || $name == 'iphorm_3_5') {
            $path = 'some/other/path/';
        }
    
        return $path;
    }
    add_filter('iphorm_upload_path_3', 'my_upload_path_3', 10, 2);
    

    Silly question on the add filter you always end in 10,2 what is this for please

    Many thanks
    Patrick

    • This reply was modified 8 years, 4 months ago by patdundee. Reason: changed code
    #17806
    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.

    #17809
    patdundee
    Participant

    That makes more sense now ๐Ÿ™‚

    #17813
    patdundee
    Participant

    Hi Ally

    I have tried the following code and also created a folder on the server call “3” I have given it full 0777 permissions and also set both User and Group to both ftpuser / ftpgroup and also tried www-data for both user and group but the file does not appear in the folder

    
    	function my_upload_path_1($path, $element)
    	{
    		$name = $element->getName();
    	
    		if ($name == 'iphorm_15_68') {
    			$path = '../../../3/';
    		}
    	
    		return $path;
    	}
    	add_filter('iphorm_upload_path_15', 'my_upload_path_1', 10, 2);
    

    Have also tried setting the path as

    
    $_SERVER['DOCUMENT_ROOT'].'/3/';
    

    Still no file
    ๐Ÿ™‚
    Any ideas?

    PS I am of course using child theme functions page as i do for all other form changes
    Many thanks

    • This reply was modified 8 years, 4 months ago by Ally.
    #17816
    patdundee
    Participant

    Hi Ally

    Sorry to bother you. This is really doing my head in lol

    I have tried every permutation i can thing of but i still end up with the same. The files always get dumped in the default iphorm year month folder

    Here is what I have I have changed the field number i am calling from 15_68 to 15_30 which is also an image upload

    
    function my_upload_path_1($path, $element)
    	{
    	$name = $element->getName();
        	if ($name == 'iphorm_15_30') {
    			$path = $_SERVER['DOCUMENT_ROOT'].'/3/';
    		}
            return $path;
    	add_filter('iphorm_upload_path_15', 'my_upload_path_1', 10, 2);
    	}
    

    Any ideas would be a great help ๐Ÿ™‚

    Many thanks
    Patrick

    #17824
    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.

    #17843
    patdundee
    Participant

    Bingo

    I can now start growing my hair again ๐Ÿ™‚

    Many thanks Ally

    Kind regards
    Patrick

    #17844
    patdundee
    Participant

    Just bought you a coffee on your coffee link ๐Ÿ™‚

    #17884
    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.

Viewing 11 posts - 1 through 11 (of 11 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