Skip to content

Instantly share code, notes, and snippets.

@halidaltuner
Created November 3, 2010 17:35
Show Gist options
  • Save halidaltuner/661404 to your computer and use it in GitHub Desktop.
Save halidaltuner/661404 to your computer and use it in GitHub Desktop.
uploadify image random name generating
<?php
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/images/products/';
$ext = pathinfo($_FILES['Filedata']['name'], PATHINFO_EXTENSION);
$newFileName = md5($tempFile.microtime()).'.'.$ext;
$targetFile = str_replace('//','/',$targetPath) . $newFileName;
move_uploaded_file($tempFile,$targetFile);
}
echo $newFileName;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment