thinkphp和uploadify一起出现文件错误,怎么解决啊?

图片说明
Call to a member function move() on null这个问题怎么解决啊?
html:

 <input type="file" name="file_img" id="file_upload" />
 <script>
$(function() {
    $("#file_upload").uploadify({
        'auto'     : true,
        'buttonClass':'layui-btn layui-btn-warm',
        'swf'      : '__STATIC__/common/uploadify/uploadify.swf',
        'uploader' : "{:url('index/baiduimg/upload')}" ,
        'fileTypeDesc': "请选择",
        'buttonText':'选择图片',
        'fileobjname':'file_img',
        'fileTypeDesc' : '只支持jpg和png',
        'fileTypeExts' : '*.jpg; *.png',
        'onFallback':function(){
            alert('文件flash出错');
        },
        'progressData':'speed',
        /*'onUploadProgress':function(file, bytesUploaded, bytesTotal, totalBytesUploaded, totalBytesTotal){
            $('#progress').html(totalBytesUploaded + ' bytes uploaded of ' + totalBytesTotal + ' bytes.');

        },*/

        'onUploadSuccess':function(file,data,response){


          alert('The file ' + file.name + ' was successfully uploaded ');

        }

php:

 <?php
namespace app\index\controller;
use think\Controller;
use baiduimg\AipImageSearch;
use think\File;
class Baiduimg extends Controller{

public function index(){


  return  $this->fetch();


}

  public function upload(){

    $file=request()->file('file_img');
    print_r($file) ;
    $info=$file->move(ROOT_PATH . 'public' . DS . 'uploads'.DS.'images');
    if($info){
        echo $info->getSaveName();
    }


  }


}

1个回答

http://www.thinkphp.cn/topic/43075.html
能不能百度下?一大堆?自主能力呢?报错这么明确了还问个啥 ?

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐