I dunno if any of you have used the easyfile plugin in the past.. but if you did and then later wanted to go with a different filemanager then you probably discovered all your files are being stored as an Octstream. They still work with a different filemanager but the name is all crazy numbers based on date, ect.. blah.. blah..
Anyways heres a simple script that will restore he original names. Just had to crap it out a bit ago so I thought I'd toss it here. If anyone has a better place for this post.. feel free to relocate it there.
<?php
// Config
$dbhost = "localhost";
$dbuser = "XXXX";
$dbpass = "XXXX";
$dbname = "XXXXXX";
$path = "/path/to/files"; // No trailing slash!
mysql_connect("$dbhost", "$dbuser", "$dbpass"
or die(mysql_error());
mysql_select_db("$dbname"
or die(mysql_error());
$query = mysql_query("select fileid, filename from gl_easyfile"
;
while($row = mysql_fetch_array($query)){
$fileid= $row['fileid'];
$filename = $row['filename'];
echo "Working with $fileid --\n";
$x = rename("$path/$fileid","$path/$filename"
;
if($x==true){
echo "$filename renamed successfully./n";
}else{
echo "Something bad happened. Files not renamed.";
}
}
?>