Webmastersite.net
Register Log In

Cannot upload again same file
with extension in caps

Comments on Cannot upload again same file

peumus
Forum Regular

Usergroup: Customer
Joined: Aug 09, 2004
Location: Chile

Total Topics: 172
Total Comments: 462
peumus
Posted Mar 13, 2005 - 4:19 AM:

Hello Paul,

Could you please check the following detail:

At Switches I have Attachments directory as category tree: Off
At Functionality I have File attachments naming method: Natural
At Functionality I have Allowed Upload Extensions: gif,jpg,jpeg,png,tif,JPG,JPEG

When uploading an image with the same name of one already uploaded all work fine, except for some images that have the extension in caps as .JPG :

When the same image name with the extension .JPG in caps is intended to be uploaded a second time attached on a new link, the following error arises:


Couldn't find an unused name. There's got to be a bug in this script if you see this. (Find me in filefunctions.php)


Thank you again.
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Mar 14, 2005 - 1:06 AM:

In filefunctions.php replace your findfilename function with this and it ought to work I think:

function findfilename ($filename)

{

global $inadmindir, $settings, $switches;

$filename = str_replace('(', '', $filename);

$filename = str_replace(')', '', $filename);

$filename = str_replace('/', '', $filename);

$filename = str_replace('\\', '', $filename);

$filename = str_replace("'", '', $filename);

$filename = str_replace('" ', '', $filename);

$filename = str_replace(' ', '', $filename);
$filename = strtolower($filename);
$exten = extension($filename);

if ($switches[attachmentstree]) { return traverseall($filename); }

else

{

if (!file_exists($settings->uploadpath . $filename)) return $filename;

else

{

for ($x=0; $x<2000; $x++)

{

$changedname = str_replace('.'. $exten, $x .'.'. $exten, $filename);

if (!file_exists($settings->uploadpath . $changedname)) return $changedname;

}

}

}

die ("Couldn't find an unused name. There's got to be a bug in this script if you see this. (Find me in filefunctions.php)");

return true;

}

peumus
Forum Regular

Usergroup: Customer
Joined: Aug 09, 2004
Location: Chile

Total Topics: 172
Total Comments: 462
peumus
Posted Mar 15, 2005 - 9:30 PM:

Thank you,

Now it's working perfectly.
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



This thread is closed, so you cannot post a reply.