Home › Forums › Quform WordPress › Multiple Upload file paths
- This topic has 10 replies, 2 voices, and was last updated 8 years, 4 months ago by Ally.
- AuthorPosts
- January 3, 2016 at 7:38 pm #17764patdundeeParticipant
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
PatrickJanuary 5, 2016 at 3:49 pm #17798AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
January 5, 2016 at 4:00 pm #17800patdundeeParticipantAh
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
January 5, 2016 at 4:18 pm #17806AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
January 5, 2016 at 4:28 pm #17809patdundeeParticipantThat makes more sense now ๐
January 5, 2016 at 5:36 pm #17813patdundeeParticipantHi 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.
January 5, 2016 at 9:33 pm #17816patdundeeParticipantHi 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
PatrickJanuary 6, 2016 at 10:20 am #17824AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
January 6, 2016 at 1:21 pm #17843patdundeeParticipantBingo
I can now start growing my hair again ๐
Many thanks Ally
Kind regards
PatrickJanuary 6, 2016 at 1:24 pm #17844patdundeeParticipantJust bought you a coffee on your coffee link ๐
January 12, 2016 at 10:44 am #17884AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.