Mini Shell
<?php
/*
Uploadify
Copyright (c) 2012 Reactive Apps, Ronnie Garcia
Released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
// Define a destination
session_start();
function temizle_tr($tr1) {
$turkce=array("ş","Ş","ı","ü","Ü","ö","Ö","ç","Ç","ş","Ş","ı","ğ","Ğ","İ","ö","Ö","Ç","ç","ü","Ü");
$duzgun=array("s","S","i","u","U","o","O","c","C","s","S","i","g","G","I","o","O","C","c","u","U");
$tr1=str_replace($turkce,$duzgun,$tr1);
$tr1 =htmlspecialchars($tr1);
return $tr1;
}
$targetFolder = '/js/upload/uploads'; // Relative to the root
$verifyToken = md5('unique_salt' . $_POST['timestamp']);
if (!empty($_FILES) && $_POST['token'] == $verifyToken) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $targetFolder;
$adi = time().temizle_tr($_FILES['Filedata']['name']);
$targetFile = rtrim($targetPath,'/') . '/' . $adi;
// Validate the file type
$fileTypes = array('doc','docx','xls','xlsx','zip','rar','pdf','jpg','jpeg','png','gif','JPG','PNG'); // File extensions
$fileParts = pathinfo($_FILES['Filedata']['name']);
if (in_array($fileParts['extension'],$fileTypes)) {
move_uploaded_file($tempFile,$targetFile);
$_SESSION['file_upload'] = $adi;
echo '1';
} else {
echo 'Invalid file type.';
}
}
?>