• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Move an uploaded file to another folder

Move an uploaded file to another folder 2 years 2 months ago #42587

Hi,

In the script called after form has been processed I am trying to move a file uploaded on a static folder (destination attribute) onto another folder whose name will depend on a $POST where field name is of type Dropdown.

Example: lets say that all files are uploaded in 'images/folder1/tmp' (the fixed destination attribute) and that I want to have them in the result of 'images/folder1/'.$POST.

What I noticed is that in the script called after form has been processed it is not possible to use a $POST for a File Upload type of field. They do not appear when I print_r($POST)
The administrator has disabled public write access.

Move an uploaded file to another folder 2 years 2 months ago #42596

  • patrick403
  • patrick403's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 42
  • Thank you received: 5
1. Navigate to the form where the uploaded file is located and open it for editing.
2. Go to the "Properties" tab and locate the "File Upload" field that contains the uploaded file.
3. Click on the "Advanced" button next to the field to expand the advanced settings.
4. In the "File Uploads" section, find the "Custom script" option and set it to "Yes".
5. In the "Custom script" field that appears, enter the following code:
$jinput = JFactory::getApplication()->input;
$file = $jinput->files->get('rsform_upload_file_name');
if ($file) {
  $source = $file['tmp_name'];
  $destination = JPATH_SITE.'/new_folder/'.$file['name'];
  move_uploaded_file($source, $destination);
}

Make sure to replace 'rsform_upload_file_name' with the name of the file upload field.
The administrator has disabled public write access.

Move an uploaded file to another folder 2 years 2 months ago #42598

Thank you of trying to help.

Unfortunately I do not understand where to do the modification you are sugesting. What you write in your first paragraphs does not correspond to what I see on my RSForms 3.1.7.

Go to the "Properties" tab and locate the "File Upload" field that contains the uploaded file. => In the Form Properties tab there is no "File Upload"
Click on the "Advanced" button next to the field to expand the advanced settings. => I do not see any "Advanced" button
In the "File Uploads" section, find the "Custom script" option and set it to "Yes". => I do not see a "File Uploads" section.
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!