• 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: Upload files with apostrophe not working

Upload files with apostrophe not working 13 years 5 months ago #15276

  • jdennis
  • jdennis's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
Whenever I upload a word doc or PDF with an apostrophe in the filename (i.e. John Doe's Resume.pdf), I can't download it from the link in the email or in the backend in Joomla.

Has anyone else had this problem or know how to fix it? Thanks.
The administrator has disabled public write access.

Re: Upload files with apostrophe not working 13 years 5 months ago #15292

  • alexp
  • alexp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 2253
  • Thank you received: 180
Hello,

please make sure that you are using a more recent version. The latest RSform!Pro revision is 42.
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
The administrator has disabled public write access.

Re: Upload files with apostrophe not working 13 years 1 month ago #16640

  • paolors1
  • paolors1's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 9
  • Thank you received: 1
I use the last revision and i have always this problem...
The administrator has disabled public write access.

Re: Upload files with apostrophe not working 13 years 1 month ago #16642

  • royce
  • royce's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 52
  • Thank you received: 5
I had to hack RSFP to perform a 'clean' on the file name. Hopefully this will be incorporated into a future release.
	// RSH 2/18/12 remove bad chars
	function filename_safe($filename) {
		$temp = $filename;
 
		// Lower case
		$temp = strtolower($temp);
 
		// Replace spaces with a '_'
		$temp = str_replace(" ", "_", $temp);
 
		// Loop through string
		$result = '';
		for ($i=0; $i<strlen($temp); $i++) {
			if (preg_match('([0-9]|[a-z]|_|\.)', $temp[$i])) {
				$result = $result . $temp[$i];
			}    
		}
 
		// Return filename
		return $result;
	}
Last Edit: 13 years 1 month ago by royce.
The administrator has disabled public write access.

Re: Upload files with apostrophe not working 13 years 1 month ago #16649

  • paolors1
  • paolors1's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 9
  • Thank you received: 1
where do I have to add this code?

tnx
The administrator has disabled public write access.

Re: Upload files with apostrophe not working 13 years 1 month ago #16652

  • royce
  • royce's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 52
  • Thank you received: 5
I added it in administrator\components\com_rsform\helpers\rsform.php and \administrator\components\com_rsform\models\submissions.php just before the JFile::upload

e.g.
// Filename
// RSH 2/18/12 - Make the filename safe - remove spaces, etc
$file = $realpath . $prefix . self::filename_safe($files['form']['name'][$fieldName]);

But remember, it is a hack and will be overwritten by the next release of RSFP. Also, only do this if you are an experienced PHP programmer.
Last Edit: 13 years 1 month ago by royce.
The administrator has disabled public write access.

Re: Upload files with apostrophe not working 13 years 1 month ago #16668

  • paolors1
  • paolors1's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 9
  • Thank you received: 1
hi royce, tnx for your support but it seems doesn't work...i do exactly like your way...are u sure that this hack is in administrator path?

Tnx
The administrator has disabled public write access.

Re: Upload files with apostrophe not working 13 years 1 month ago #16672

  • royce
  • royce's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 52
  • Thank you received: 5
I had the same issue, trying to get a valid link to an uploaded file from an external system - invalid characters would break the link.

I only gave a short example of where and how I implemented it, I don't remember if I had to do anything else. Are you able to follow their code? Did you run it in a debugger?

Not sure what your problem is.

It would be better for everyone if RSFP added this simple modification to their code.
The administrator has disabled public write access.

Re: Upload files with apostrophe not working 13 years 1 month ago #16693

  • paolors1
  • paolors1's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 9
  • Thank you received: 1
ok...tnx for your support....
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!