• 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: Change File Prefix to First name from form

Change File Prefix to First name from form 12 years 4 months ago #15825

  • redmar
  • redmar's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 10
  • Thank you received: 3
Hi,
I'm trying to change the default File Prefix to a field from the form.

What I want:
Field name "First name" placed in front of the file-name, for example Redmar_photo.jpg where the value Redmar is fetched from the field name 'first-name' and appended to the uploaded file name, photo.jpg.

What PHP code should I put in File Prefix?
//<code>

//</code>

Thanks!
The administrator has disabled public write access.

Re: Change File Prefix to First name from form 12 years 3 months ago #15845

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

You can consider simply returning the First Name of the from the $_POST variable and so the first name will be correctly set as the file prefix. For example you can use something like this:
//<code>
return $_POST['form']['First name']."_";
//</code>
The administrator has disabled public write access.
The following user(s) said Thank You: webcat-solutions, andayanifrench

Re: Change File Prefix to First name from form 12 years 3 months ago #15955

  • redmar
  • redmar's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 10
  • Thank you received: 3
Hi Bogdanc,

Thank you very much and my apologies for my late reply; I was on vacation:)

Your solution works! Though I can't figure out how I can get RSformPro to rename the file with multiple fields. Example of what I want:

Firstname_Lastname_Referencenumber_Originalfilename.jpg

Can this be done?
Last Edit: 12 years 3 months ago by redmar. Reason: Typo
The administrator has disabled public write access.

Re: Change File Prefix to First name from form 9 years 10 months ago #27840

  • gutzo
  • gutzo's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
Hi Redmar,

Did you ever find out how to rename the file prefix with multiple fields? I would like to know as well.

Thank you.
The administrator has disabled public write access.

Re: Change File Prefix to First name from form 9 years 10 months ago #27842

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
You can add as many fields as you need by following a syntax like this one:
//<code>
return $_POST['form']['field_name1']."_".$_POST['form']['field_name2']."_".$_POST['form']['fiel_name3']."_";
//</code>
My help is not official customer support. To receive your support, submit a ticket by clicking here
The administrator has disabled public write access.
The following user(s) said Thank You: kkoweb, nathan82, gutzo

Re: Change File Prefix to First name from form 9 years 10 months ago #27849

  • gutzo
  • gutzo's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
Thank you Cosmin. I appreciate the support.
The administrator has disabled public write access.

Change File Prefix to First name from form 9 years 10 months ago #27869

  • gutzo
  • gutzo's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
Hi Cosmin,

When creating a new form submission the file prefix for the uploaded document works perfectly but when the user uploaded the document via the Submissions Directory after form submission only the _ in the file prefix are displayed and not the field placeholders for example "First name".

Is there something I can do to fix this?

Thank you.
The administrator has disabled public write access.

Change File Prefix to First name from form 9 years 8 months ago #28471

  • patrick.jackson
  • patrick.jackson's Avatar
  • OFFLINE
  • Junior Boarder
  • Joomla Consultant, Melbourne Australia
  • Posts: 21
  • Thank you received: 4
Gutzo,

While looking for something else relating to filenames (want to actually strip the original filename out and rename the file to the new format) I thought I'd see if I can help with your values being missing.

$_POST - the field_name part needs to match your field names exactly - case sensitive. You might need to check also if your field names have spaces in them... this can cause issues at times - I recommend not having spaces in the field names.

Patrick
Joomla Consultant & Hosting Provider
Melbourne Australia
The administrator has disabled public write access.

Change File Prefix to First name from form 8 years 9 months ago #31888

Hi,

I'd like to use that prefix for file upload.

must before the uploaded file name, enter the user ID. how can I do this?

My form is registration with "SQL mapping" integrating with community bulder and usage Global: userid for new user registration.

I guess I have to get the user id that is registering in a hidden field.
and then in the field prefix upload file, I use the code above with the name of the hidden field?

if so how should I do it?

Awaiting return

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