首页 > 其他 > 详细

图片保存到本地

时间:2017-10-14 14:20:40      阅读:229      评论:0      收藏:0      [点我收藏+]

html部分
图片:<input type="file" name="files[]">

 

controller部分
$n_path = $_FILES[‘files‘];
$url = $this->actionUpload($n_path);


public function actionUpload($file)
{
$str = "";//防止替换
$url = "./uploads/";//路径
for ($i = 0; $i < count($file[‘name‘]); $i++) {

move_uploaded_file($file[‘tmp_name‘][$i], $url . $file [‘name‘][$i]);//移动图片

  $str = $str . ‘,‘ . $url . $file[‘name‘][$i];
}
  return trim($str,‘,‘);
}

图片保存到本地

原文:http://www.cnblogs.com/lrszw/p/7666829.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!