用thinkphp3.2.3的liaray中的Think文件下面的upload.class.php的实现,网上百度搜出来的真的是五花八门,各种各样,自己实践总结出来上传图片基于thinkphp3.2.3正确写法if (!empty($_FILES)) {<br>
if($_FILES['img']['size']>2*1024*1024){ <br>
$this->error("上传图片大小不能大于2M");<br>
}<br>
$config=array(<br>
'exts'=>array('jpg','gif','png'),<br>
'rootPath'=>'./public/', //sae上的domain<br>
'savePath'=>'upload/', //sae会自动创建<br>
'saveRule'=>'time',<br>
);<br>
$upload = new \Think\Upload($config,'Sae'); //sae一定要写<br>
$upload->thumb=false;<br>
if (!$info=$upload->upload()) {<br>
echo $upload->getError();die;<br>
$this->error($upload->getError());<br>
} else {<br>
$_POST['img']=$info['img']['url'];<br>
}<br>
if(M("work")->add($_POST)){ <br>
$this->success("提交成功",U('Index/work'));<br>
}else{ <br>
$this->error("提交失败");<br>
}<br>
}
AD:真正免费,域名+虚机+企业邮箱=0元

Heiße KI -Werkzeuge

Undresser.AI Undress
KI-gestützte App zum Erstellen realistischer Aktfotos

AI Clothes Remover
Online-KI-Tool zum Entfernen von Kleidung aus Fotos.

Undress AI Tool
Ausziehbilder kostenlos

Clothoff.io
KI-Kleiderentferner

AI Hentai Generator
Erstellen Sie kostenlos Ai Hentai.

Heißer Artikel

Heiße Werkzeuge

Dreamweaver Mac
Visuelle Webentwicklungstools

PHPStorm Mac-Version
Das neueste (2018.2.1) professionelle, integrierte PHP-Entwicklungstool

MantisBT
Mantis ist ein einfach zu implementierendes webbasiertes Tool zur Fehlerverfolgung, das die Fehlerverfolgung von Produkten unterstützen soll. Es erfordert PHP, MySQL und einen Webserver. Schauen Sie sich unsere Demo- und Hosting-Services an.

SAP NetWeaver Server-Adapter für Eclipse
Integrieren Sie Eclipse mit dem SAP NetWeaver-Anwendungsserver.

WebStorm-Mac-Version
Nützliche JavaScript-Entwicklungstools