uploadify を使用して画像をアップロードしています。幅:670px 高さ:200px の画像以外のアップロードを制限する方法はありますか? ここに私のuploadify.phpコードがあります
<?php
require_once("includes/connection.php");
$targetFolder = '/workbench/sudeepc/photogallery/uploads' ;
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $targetFolder;
$targetFile = rtrim($targetPath,'/') . '/' . $_FILES['Filedata']['name'];
// Validate the file type
$fileTypes = array('jpg','jpeg','gif','png'); // File extensions
$fileParts = pathinfo($_FILES['Filedata']['name']);
if (in_array($fileParts['extension'],$fileTypes)) {
move_uploaded_file($tempFile,$targetFile);
$query="INSERT INTO `photo` ( `id` , `path` , `uname` )
VALUES (
'','${targetFile}', 'testnn');";
mysql_query($query,$connection);
} else {
echo 'Invalid file type.';
}
}
?>
前もって感謝します 。