// 上传文件2. $fileElementName = "file";3. $filedata = file_get_contents($_FILES[$fileElementName]["tmp_name"]);4. if(empty($_FILES[$fileElementName]['tmp_name'])){5. $this->error('没有上传的文件!');6. return false;7. }8. $Images = M('images');9. $data['id'] = '';10. $data['binary'] = $filedata; 11. $data['created_at']= date('Y-m-d H:i:s',time());12. $data['creatwww.hnnedu.comed_by_user']= 0;13. $data['type']=$_FILES[$fileElementName]["type"]; 14. 15. $img = $Images->add($data);16. $result['imageId'] = $img;17. $result['state'] = 1;18. $this->ajaxReturn($result);