Welcome, Guest
  • Page:
  • 1

TOPIC: Uploaded file rename

Uploaded file rename 1 year, 11 months ago #14017

How do I rename the uploaded files from quickforms to be a unique name of

20100618132309.cv.doc

rather than the default, which adds the time code to the end of the file such as

cv.doc.20100618132309


if the timecode was at the start, the files would still open when they are downloaded, withought having to rename each and every file after download...

Thanks

Steven
  • StevenD
  • OFFLINE
  • Junior Boarder
  • Posts: 26
  • Karma: 0

Re: Uploaded file rename 1 year, 10 months ago #14415

Can anyone help with this please...

Steven
  • StevenD
  • OFFLINE
  • Junior Boarder
  • Posts: 26
  • Karma: 0

Re: Uploaded file rename 1 year, 10 months ago #14425

Good luck with that in here. I have been trying to get answers like this for weeks.
  • htown
  • OFFLINE
  • Senior Boarder
  • Posts: 52
  • Karma: 0

Re: Uploaded file rename 1 year, 10 months ago #14432

Hey Steven,

What version of BreezingForms are you using? I believe this has been fixed in the most recent, Version 1.7.2.
  • terrywmu
  • OFFLINE
  • Administrator
  • Posts: 510
  • Karma: 8

Re: Uploaded file rename 1 year, 9 months ago #15518

Here's a fix that works:

Open /components/com_facileforms/facileforms.process.php

Look for this:
if ($timestamp) $path .= '.'.date('YmdHis');


And change it to this:
if ($timestamp) $path .= date('YmdHis').'.'.$userfile_name;

...a few lines down do it again.

Then go farther down (for the Flash uploads)and find this:
if ($row->flag1) $path .= '.'.date('YmdHis');


And change it to this:
if ($row->flag1) $path .= date('YmdHis').'.'.$userfile_name;

...a few lines down do it again.

In the end you have this:
Standard Upload
// Changed so that the timestamp goes before the extension
//		if ($timestamp) $path .= '.'.date('YmdHis');
// This is the new line of code
		if ($timestamp) $path .= date('YmdHis').'.'.$userfile_name;
		if (file_exists($path)) {
			$rnd = md5( mt_rand(0, mt_getrandmax()) );
			$path = $baseDir.'/'.$rnd.'_'.$userfile_name;
// Changed so that the timestamp goes before the extension
//			if ($timestamp) $path .= '.'.date('YmdHis');
// This is the new line of code
		if ($timestamp) $path .= date('YmdHis').'.'.$userfile_name;


For Flash Uploader:
// Changed Old Code - timestamp after extension
//	if ($row->flag1) $path .= '.'.date('YmdHis');
// New line of code below
if ($row->flag1) $path .= date('YmdHis').'.'.$userfile_name;										

if (file_exists($path)) {
$rnd = md5( mt_rand(0, mt_getrandmax()) );
$path = $baseDir.'/'.$rnd.'_'.$userfile_name;
// Changed Old code - timestamp after file extension
//	if ($row->flag1) $path .= '.'.date('YmdHis');
// New line of code below
 if ($row->flag1) $path .= date('YmdHis').'.'.$userfile_name;


This works in version 1.71
Just for convenience sake, I coded it so it names the file the original filename + timestamp + original filename. This way the files can be sorted as though they were never renamed.

Now I'm wondering how to preview uploaded images on the thank you page. Any ideas?
  • erichhaubrich
  • OFFLINE
  • Senior Boarder
  • Web Ninja and Technology Geek
  • Posts: 62
  • Karma: 3
I love Breezing Forms! - It is the Killer App for Forms on Joomla!
  • Page:
  • 1
Moderators: TheMuffinMan, ForumSupport
Time to create page: 0.32 seconds

Facebook Discount - 40% Off!

Fans of our Facebook page here are entitled to get a 1-year-subscription for the price of a 6-months!

Steps to take:

  • Become a fan on Facebook (Like) here
  • Purchase a 6-months-subscription from here
  • Write a quick email to This email address is being protected from spambots. You need JavaScript enabled to view it. with your username and prove of your like and we'll upgrade to the 1-year-subscription

Joomla!® Forms Discount - 40% Off!

Already purchased a forms extension from a different vendor but your requirements changed and now you need a forms extension that is capable of more than just the standards? We help you to keep the costs for a change under control: Get a 40% discount on our professional membership plan! -- meaning timely unlimited access to all current and future commercial extensions, breezingforms themes & apps and Joomla!® templates at crosstec.de, including 1 year of support -- without any website limitations -- Just prove that you previously purchased another forms extension for Joomla!® from a different vendor and you are qualified.

Steps to take:

  • Purchase a 1-year-subscription from here
  • Write a quick email to This email address is being protected from spambots. You need JavaScript enabled to view it. with your username and prove of the purchase for the other form vendor and we'll upgrade to the professional-subscription

About

Crosstec GmbH & Co. KG

Bergisch-Gladbacher-Str. 829

51069 Cologne, Germany

Imprint