• 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: replace spaces in upload filename

replace spaces in upload filename 8 years 11 months ago #35019

If you do not want spaces on the file that was uploaded in your form, you can use a php script after the form is processed to rename the file. After many different attempts, this one worked for me.

//This code will rename the uploaded file replacing the spaces in the filename
//In RSForms Pro, put this code
//Manage Forms --> Form Properties --> PhP Scripts --> Script called after form has been processed

// Initialize Variables
$filename='';
$fromPath='';
$origFilename='';
$fromOrig='';
//* Get the filename
foreach ($_FILES as $name => $value) {
if (is_array($value)) {
$value = implode(', ', $value);
}
if ("name" == $name) {
$filename=$value;
}
}
// Stores Original Name, removes Spaces
$origFilename=$filename;
$filename=str_replace(' ','_',$filename);
// This will rename the original file
$fromOrig = JPATH_SITE.'/your/directory/for/uploads/'.$origFilename;
$fromPath = JPATH_SITE.'/your/directory/for/uploads/'.$filename;
rename($fromOrig, $fromPath);
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!