The first one:
php part
Copy the code The code is as follows:
if($_FILES['file']['error'] > 0){
echo '!problem :';
switch($_FILES['file']['error'])
{
case 1: echo 'The file size exceeds the server limit';
case 2: echo 'The file size exceeds the server limit'; ';
break; ';
break; ';
break; ';
exit;
}
if($_FILES['file']['type']!='image/jpeg' && $_FILES['file']['type']!='image/gif') {
echo ‘The file is not a JPG or GIF image! ';
exit;
}
$today = date("YmdHis");
$filetype = $_FILES['file']['type'];
if($filetype == 'image/jpeg'){
$type = '.jpg';
}
if($filetype == 'image/gif'){
$type = '.gif';
}
$upfile = 'upfile/' . $today . $type;
if(is_uploaded_file($_FILES['file']['tmp_name']))
{
if(!move_uploaded_file($_FILES['file']['tmp_name'], $upfile))
{
echo 'Move File failed!
exit; br>';
echo 'File size :' . $_FILES['file']['size'] . 'bytes' . '
';
echo 'File path:' . $upfile;
echo '
';
$dirr = 'upfile/';
$dir = opendir($dirr);
echo $dirr . '--Listing:
if(empty($_GET[submit]))
{
?>