TOPIC:

File Upload - Filename for existing file 3 weeks 2 days ago #245312

  • Topic Author
  • simun
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 104
  • Thanks: 0
Hi,

With the default settings for the File Upload element, the filename when uploaded into BF will be the actual filename of the file.

However, if a file with the same name already exists on the server, then a number is added in front of the filename.

This seemingly random number/text generated in front of it is however rather long, 32 characters actually!

When used together with ContentBuilder and included in list to display records this makes the "upload" column in the list very wide compressing the other text columns because of the long filename.

Is there any way either by setting or some code modification to reduce this generated number, e.g. down to maybe 5 characters?


Another thing is that I found that files can be re-named upon upload with file masks according to this page:
Uploads with dynamic names and folders
This could be an alternative, but those file mask tags rename the filename completely?
There isn't any option to keep the original filename but with an added file mask to it?
Here I would have imagined to have something like this, e.g.:
{ff_uploads}/{original-filename}{filemask:_date}
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: Post by simun.

File Upload - Filename for existing file 3 weeks 2 days ago #245314

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 9796
  • Karma: 167
  • Thanks: 785
Hi,

Please use {filemask:_filename} for filemasks.

Fyi: Since the last update from yesterday, you can enable file overriding by adding this in form => advanced => more options => form pieces => before form:
JFactory::getSession()->set('bfFileUploadOverride', false);

This will actually replace the file if a new one is uploaded.
It is intended to be used for custom file code, but can be used for this purpose, as well.

Regards,
Markus

Please Log in or Create an account to join the conversation.

File Upload - Filename for existing file 3 weeks 2 days ago #245328

  • Topic Author
  • simun
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 104
  • Thanks: 0
Hi,

Thanks, the {filemask:_filename} tag was not mentioned on the documentation page, so it maybe needs an update.
For a date filemasks, it seems there is only the {filemask:_datetime} not just any {filemask:_date} (without the timestamp)?


I also tested the overriding code. It seems to work nicely too and does indeed override the old file with same name.
It however doesn't seem to work very well if you happen to upload a file with same name as another record has. Then both records will share the same file, and if it were to be edited and deleted, the file would also be deleted in the previous record (Actually only the file gets deleted, the record-value is still there) which is a bit odd.
Also if the file is an image and using ContentBuilder with the CBImageScale plugin the image thumbnail doesn't seem to get updated.
So maybe not very suitable for this case.

Please Log in or Create an account to join the conversation.

File Upload - Filename for existing file 3 weeks 2 days ago #245341

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 9796
  • Karma: 167
  • Thanks: 785
That's why I would use a folder mask or better different upload locations per form element alongside this option.

And yes, _date is missing for some reason. I added it now. Please download, unzip and copy the file attached to /components/com_breezingforms/

File Attachment:

File Name: facileform...22-3.zip
File Size:62 KB


With this you can use {filemask:_date}, too.

Regards,
Markus
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: Post by TheMuffinMan.
  • Page:
  • 1
Moderators: ForumSupport
Time to create page: 0.052 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

Summer Sale!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!