I used the mass upload option to upload a tar.gz file. The files were added to the correct index level and put into the main attachments directory. Everything alright sofar.
Now, when regenerating the files are moved to the correct directory. However, the files aren't randomly named, but still use the same names which they had in the tar.gz file.
Comments on Mass upload random naming
Forum Regular
Usergroup: Member
Joined: Jul 01, 2003
Total Topics: 38
Total Comments: 164
- Attachment tree: On.
I used the mass upload option to upload a tar.gz file. The files were added to the correct index level and put into the main attachments directory. Everything alright sofar.
Now, when regenerating the files are moved to the correct directory. However, the files aren't randomly named, but still use the same names which they had in the tar.gz file.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
In filefunctions.php replace the findfilename function with this one:
function findfilename ($filename)
{
global $inadmindir, $settings, $switches;
$ext = extension($filename);
if ($settings->attachmentmethod != 'natural')
{
$randomname = md5(microtime()) . $ext;
if ($ext == 'php' || $ext == 'asp' || $ext == 'pl' || $ext == 'jsp' || $ext == 'cgi') $changedname = str_replace('.'. $ext, '.txt', $randomname);
else if ($settings->removeextensions == 'yes') $changedname = str_replace('.'. $ext, '.wsn', $randomname);
return $changedname;
}
$filename = strtolower($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 = str_replace(' ', '', $filename);
if ($ext == 'php' || $ext == 'asp' || $ext == 'pl' || $ext == 'jsp' || $ext == 'cgi') $changedname = str_replace('.'. $ext, '.txt', $filename);
else if ($settings->removeextensions == 'yes') $changedname = str_replace('.'. $ext, '.wsn', $filename);
if ($switches[attachmentstree]) { return traverseall($filename); }
else
{
if (!file_exists($settings->uploadpath . $filename) && !file_exists($settings->uploadpath .'avatars/'. $filename)) return $filename;
else
{
for ($x=0; $xuploadpath . $changedname) && !file_exists($settings->uploadpath .'avatars/'. $filename)) return $changedname;
}
}
}
die ("Couldn't find an unused name for $filename . There's got to be a bug in this script if you see this. (Find me in filefunctions.php)");
return true;
}
Haven't tested yet.
Forum Regular
Usergroup: Member
Joined: Jul 01, 2003
Total Topics: 38
Total Comments: 164
Thanks.
Haven't tried it either as I managed to get FTP import to work for me.