• 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: Feature Request: Option to strip spaces on upload

Feature Request: Option to strip spaces on upload 7 years 5 months ago #36033

  • patrick.jackson
  • patrick.jackson's Avatar
  • OFFLINE
  • Junior Boarder
  • Joomla Consultant, Melbourne Australia
  • Posts: 21
  • Thank you received: 4
Hoping to get a feature request incorporated, following returning to the same problem again a few years after the last time I encountered it.

I use data submittedin RSForms that then gets mapped to a different table to then go on and generate access passes that have photos on them. So the RSForm allows the person requiring the pass to upload their photo.

The issue is with TCPDF not accepting spaces in image file names. So I'd like to str_replace the spaces with _ on upload, but at the moment that can only be done by editing the relevant line in the core RSForms files, so each time the component gets updated that would be overwritten.

The solution is outlined in this post:
www.rsjoomla.com/forum/37-rsform-pro/243...load-name.html#31280

A simple change of /administrator/components/com_rsform/helpers/rsform.php to replace spaces with _ would suffice, though that would blanket change it. More user friendly would be to add it as an attribute.


Sending this as a support ticket also, but thought readers would like to comment on it possibly.
Joomla Consultant & Hosting Provider
Melbourne Australia
The administrator has disabled public write access.

Feature Request: Option to strip spaces on upload 7 years 5 months ago #36035

  • patrick.jackson
  • patrick.jackson's Avatar
  • OFFLINE
  • Junior Boarder
  • Joomla Consultant, Melbourne Australia
  • Posts: 21
  • Thank you received: 4
Update relating to where to go to fix this.

In RSForms

administrator\components\com_rsform\helpers\fields\fileupload.php on line 210:

Change
$file = $realpath . $prefix . $actualFile['name'];

to
$file = $realpath . $prefix . str_replace(" ","_",$actualFile['name']);

Note that this can be improved by getting a parameter set up to define what the character to use instead of space should be.
Joomla Consultant & Hosting Provider
Melbourne Australia
The administrator has disabled public write access.
The following user(s) said Thank You: gretchen6

Feature Request: Option to strip spaces on upload 7 years 5 months ago #36076

I'm confused, I'm seeing that in line 105. But, I tried it and IT WORKED!! Thank you!

Gretchen
The administrator has disabled public write access.

Feature Request: Option to strip spaces on upload 7 years 5 months ago #36096

  • patrick.jackson
  • patrick.jackson's Avatar
  • OFFLINE
  • Junior Boarder
  • Joomla Consultant, Melbourne Australia
  • Posts: 21
  • Thank you received: 4
If you're seeing it in line 105, then you're possibly using an old version of RSForms. The code moved in the latest version to the second post's info. An even better method though has been supplied to me in my support ticket:


"Please note that there is no need to adjust the default files of the component in order to replace the space from the uploaded file name, this can also be achieved using the PHP Scripts section of the form. You can try achieving your scenario by heading to Components > RSForm!Pro > Manage Forms > Selecting your form > Properties > PHP Scripts > and adding a syntax as the following in the "Scripts Called on form process" section:
$_FILES["form"]["name"]=str_replace(" ","_",$_FILES["form"]["name"]);

Afterwards you can test the upload functionality one more time."
Joomla Consultant & Hosting Provider
Melbourne Australia
Last Edit: 7 years 5 months ago by patrick.jackson. Reason: Updated with support request method.
The administrator has disabled public write access.
The following user(s) said Thank You: jami

Feature Request: Option to strip spaces on upload 7 years 5 months ago #36101

We are using 1.52.4 on Joomla 3.6.4. I tried the php solution, and it worked nicely. Substitutes underscores for the spaces. Thank you very much! :cheer:
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!