141 comments found

  • Bought between 50 and 99 items
  • Has been a member for 5-6 years
yinka007 Purchased

How can i rename an uploaded file to prevent an overwrite.

QuanticaLabs

You can replace line 13 in upload.php file:

$targetFile =  $targetPath . stripslashes($_FILES["Filedata"]["name"]);

with below code:
$pathinfo = pathinfo($_FILES['Filedata']['name']);
$fileExt = $pathinfo["extension"];
$fileName = stripslashes($pathinfo["filename"]) . time();
$targetFile =  $targetPath . $fileName . "." . $fileExt;
by
by
by
by
by
by