• 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: Disable file upload renaming

Disable file upload renaming 15 years 10 months ago #7803

What do I need to do so that when a file is uploaded the filename stays exactly the same, and doesnt get renamed?
The administrator has disabled public write access.

Re:Disable file upload renaming 15 years 10 months ago #7845

  • bogdanc
  • bogdanc's Avatar
  • OFFLINE
  • Moderator
  • Posts: 669
  • Thank you received: 11
Hello,

In order to do that you will have to modify the source code of the program.

Regards!
The administrator has disabled public write access.

Re:Disable file upload renaming 15 years 3 months ago #9364

  • dominic.conrad
  • dominic.conrad's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 15
  • Thank you received: 2
bogdanc wrote:
Hello,

In order to do that you will have to modify the source code of the program.

Regards!


Could you be more specific with code page path and line numbers etc?
The administrator has disabled public write access.

Re:Disable file upload renaming 15 years 3 months ago #9365

  • andreic
  • andreic's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 745
  • Thank you received: 66
Hello,

In order to achieve this you will have to modify the functions.php file located in components/com_rsform/controller. You will have to replace:
// todo - customize prefix
$timestamp = uniqid('');
// todo - handle files through joomla
move_uploaded_file($tmp_name[$i],$dest[$i].$timestamp.'-'.$name[$i]);
@chmod($dest[$i].$timestamp.'-'.$name[$i],0644);
$file = $dest[$i].$timestamp.'-'.$name[$i];

with:
// todo - handle files through joomla
move_uploaded_file($tmp_name[$i],$dest[$i].$name[$i]);
@chmod($dest[$i].$name[$i],0644);
$file = $dest[$i].$name[$i];

Please note that any change to the source code will be lost after an update is performed.
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.

Disable file upload renaming 4 years 1 month ago #41084

  • harry8
  • harry8's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
Hi, This is easy to do - just 3 lines of code...

On the file upload field, under the "Attributes" tab...

In the "File Prefix (leave blank for default)" field enter this code:

//<code>
return '';
//</code>

Save the form and test the upload, the file uploaded through that upload field now retains its original name...

And as you haven't altered any of RSForm!Pro's core code, updating the software will not remove your custom code...

Enjoy!
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!