我正在工作的用户有一个选项来上传图像,如果他们没有上传图像然后我将使用他们的个人资料的默认图像,但我有一些问题,我想要验证它们只能上传,但现在,即使他们没有上传我的验证代码运行的图像,而不是让保存下面的表格其余形象是我的代码PHP图像上传
if(isset($_FILES))
{
$imagename = $_FILES['uploadimage']['name'];
$imagetype = $_FILES['uploadimage']['type'];
$imagesize = $_FILES['uploadimage']['size'];
if($imagetype != "image/gif" || $imagetype != "image/jpg" || $imagetype == "image/png" || $imagetype == "image/jpeg")
{
$error = 'Please upload an image with JPG, PNG, GIF';
}
elseif($imagesize > 716800)
{
$error = 'Image Needs to be under 700kb only';
}
else
{
$success = 'Uploaded';
}
即使他们没有上传整个代码运行的图像
漂亮的小上传库有一些非常漂亮的jQuery功能:https://github.com/blueimp/jQuery-File-Upload – Kzqai