Created
November 3, 2010 17:35
-
-
Save halidaltuner/661404 to your computer and use it in GitHub Desktop.
uploadify image random name generating
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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