我正在使用 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.';
}
}
?>
提前致谢 。