Welcome, Guest

Uploaded file rename
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Uploaded file rename

Uploaded file rename 1 year, 7 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, 7 months ago #14415

Can anyone help with this please...

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

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

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

Re: Uploaded file rename 1 year, 7 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: 527
  • Karma: 8

Re: Uploaded file rename 1 year, 6 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.37 seconds

About

Crosstec GmbH & Co. KG

Bergisch-Gladbacher-Str. 829

51069 Cologne, Germany