The sample code is incorrect and the file format is incorrect, line 51.
 
  2018-01-30 11:38:12
0
2
1477

<?php

//Judge error code

require("upload.html");


##if( $_FILES['file']['error']>0){

switch($_FILES['file']['error']){

case '1':

echo 'The file is too large';

break;

case '2':

echo 'The file exceeds the specified size ';

                                                                                                                                        break; case '4':

echo 'The file was not uploaded';

break;

case '6':

echo 'The specified file cannot be found Folder';

                                                                                                                                                                                                       break; # default:

echo 'Upload error</br>';

}

}else{

if( $_FILES['file']['size']>200000){

exit("The file exceeds the specified size");

}

//Judge the file suffix name

$allowsuffix = array('png','jpg','jpeg');

$filename = explode(' .',$_FILES['file']['name']);

$filesuffix = array_pop($filename);

if(!in_array($filesuffix,$allowsuffix)) {

exit("The file suffix is ​​incorrect");

}

$allowmine = array(

"image/ png",

"image/jpg",

"image/jpeg",

"image/pjpeg",

"image/gif" ,

);

if(!in_array($_FILES['file']['name'],$allowmine)){

exit("The file format is not Correct");

}

//Specify the upload file path

$path = "d:/phpstudy/ PHPtutorial/www/upload/image/";

$newname = date('YmdHis').rand(0,9).'.'.$filesuffix;

$filepath = $ path.$newname;

if(is_uploaded_file($_FILES['file']['tmp_name'])){

if(move_uploaded_file($_FILES['file']['tmp_name '],$filepath)){

echo "Upload successful";

}else{

echo "Upload failed";

}

}else{

echo"Upload error";

}

}

##?> ;

 
 

reply all(2)
phpcn_u102508

There is an extra number at the end of the array,

lge

I don’t understand, what’s the error? Line 51

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template