htinkphp upload image "Illegal image file"
Local can, not on the server, but the upload TXT file is successful, is certainly not a directory permissions problem. Solving
Save attachments below the specified path
$upload = new UploadFile ();//instantiation of upload class
$upload->maxsize = 2*1024*1024;//Set attachment upload size
$upload->allowexts = Explode (', ', ' jpg,gif,png,jpeg,txt,doc,docx,wps,xls,et,zip,tar,rar,gz,7z ');//Set attachment upload type
$upload->savepath = ' tpl/public/uploads/task_description/';//Set Attachments upload Directory
Modify the name of the uploaded file
$file _name=$_files[' taskfile ' [' name '];
$expand _name=explode (".", $file _name);
$new _name=date (' Ymdhis ', Time ()). Strtolower ($expand _name[count ($expand _name)-1]);
$_files["Taskfile" ["Name"]= $new _name;
if (! $upload->upload ()) {//Upload error error message
echo $upload->geterrormsg ();
$this->error ($upload->geterrormsg ());
}else{
$info = $upload->getuploadfileinfo ();
Save the data to the database
$data [' Wlfileurl ']= $info [0][' Savepath ']. $new _name;
} thinkphp? picture upload?
Share to:
------Solution--------------------
Since the local can, the server does not, that must be the server there is a limit.
You pass a small picture and try it.
------Solution--------------------
A few more pictures to try, there may be a picture problem, there are dozens of to see your php file encoding best UTF8, there may be coding problems can also cause the inability to upload