これを試して
$targetFolder = $UPLOAD_PATH; // Relative to the root
$verifyToken = md5('unique_salt' . $_POST['timestamp']);
if (!empty($_FILES) && $_POST['token'] == $verifyToken) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $targetFolder;
$targetFileName = $int_pkid.".".$targetFileExt;;
$targetFile = rtrim($targetPath,'/') . '/' . $targetFileName;
// Validate the file type
$fileTypes = array('pdf','doc','docx'); // File extensions
$fileParts = pathinfo($_FILES['Filedata']['name']);
if (in_array($fileParts['extension'],$fileTypes)) {
move_uploaded_file($tempFile,$targetFile);
echo '1';
//Will Enter this Block only when the upload is success
//This should fix one of you
$str_query_insert="INSERT INTO tr_file_data (pkid,title,filename)";
$str_query_insert.=" VALUES(".$int_pkid.",'".${str_title}."','".${targetFileName}."')";
ExecuteQuery($str_query_insert);
//To Reload, there are no straight legal ways, but can do with a twist
//Method 1:
Header('Location: '.$_SERVER['PHP_SELF']);
Exit(); //optional
//Method 2:
echo '<script>parent.window.location.reload(true);</script>';
} else {
echo 'Invalid file type.';
}
}
// To apply directly to uploadify
$(function() {
$("#file_upload").uploadify({
'swf' : '/uploadify/uploadify.swf',
'uploader' : '/uploadify/uploadify.php',
'onUploadComplete' : function(file) {
alert('The file ' + file.name + ' finished proce`enter code here`ssing.');
//Will Enter this Block only when the upload is success
//This should fix one of you
$str_query_insert="INSERT INTO tr_file_data (pkid,title,filename)";
$str_query_insert.=" VALUES(".$int_pkid.",'".${str_title}."','".${targetFileName}."')";
ExecuteQuery($str_query_insert);
//To Reload, there are no straight legal ways, but can do with a twist
//Method 1:
Header('Location: '.$_SERVER['PHP_SELF']);
Exit(); //optional
//Method 2:
echo '<script>parent.window.location.reload(true);</script>';
}
});
});