okay, i'm running into a problem. Basically, I have a user upload a file. I split apart the filename and extension and put those into a MySQL database , so if a user uploaded file.html , file goes into filename, and .html goes into ext.
Now I have another script where the user can rename the file (but not the file extension). I can rename the filename field in the MySQL database, no problem. But I'm running into problems when I try to rename the actual file on the server. Any help?
my rename SQL code
$result = mysql_query("UPDATE filemanager SET first = \"$newfile\" WHERE filename = \"$oldfile\" AND title = \"$title\"", $linkID);
rename("./$oldfile", "./$newfile");
some of my SQL code when uploaded (and I realize that a lot of this is crappy code)
$resultID2 = mysql_query("SELECT * FROM filemanager WHERE title LIKE '$title'", $linkID);
$resultID3 = mysql_query ("SELECT CONCAT(filename, '.', ext) AS filepath FROM filemanager WHERE title LIKE '$title'", $linkID);
print "<table border=\"1\"><tr><th>Title</th>";
print "<th>Filename</th><th>Filesize</th><th>Date</th>";
for ($x=0; $x < mysql_num_rows($resultID2); $x++)
{ $row2 = mysql_fetch_assoc($resultID3);
$row = mysql_fetch_assoc($resultID2);
print "<center><tr>";
print "<td>" . $row[title] . "</td>";
print "<td><a href=" . $row2[filepath] .">" . $row2[filepath] ."</a></td>";
print "<td>" . $row[filesize] . "</td>";
print "<td>" . $row[date] . "</td>";
print "</tr>";
}