【问题标题】:laravel upload image in google app enginelaravel 在谷歌应用引擎中上传图片
【发布时间】:2014-07-04 00:36:48
【问题描述】:

我正在尝试在 laravel 4 中上传图像。在本地它可以工作,上传图像并将路径保存在数据库中,但问题是当使用 google 应用程序引擎部署时它不起作用。它显示了这个错误:

Symfony\Component\Debug\Exception\FatalErrorException 调用 非对象上的成员函数 getClientOriginalExtension()

查看

{{ Form::model($v, array('files' => true,'route' => array('upload.image', $v->id),'method' => 'post','class'=>'form-horizontal','id'=>'upload-images')) }}
            {{ Form::file('image') }}
            <br>
            {{ Form::submit('Add Photo', array('class' => 'btn btn-primary' )) }}
            {{ Form::close() }}

控制器

$file = Input::file('image');

        $destinationPath = 'img_gallery/';
        $extension = $file->getClientOriginalExtension();
        $filename = 'img_' . $id . '.' . $extension;
        $file->move($destinationPath, $filename);

        $car = Car::find($id);
        $car->Pic = $filename;
        $car->save();

如果我尝试 dd($file) 它显示 NULL。 这里有什么问题?

【问题讨论】:

    标签: google-app-engine file-upload laravel-4


    【解决方案1】:

    gae不允许你直接上传文件,但使用必须先阅读这个https://developers.google.com/appengine/docs/php/googlestorage/user_upload#createuploadurl_options

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-10-18
      • 2015-07-14
      • 2012-06-09
      • 2020-10-30
      • 2014-10-15
      • 2012-05-01
      • 1970-01-01
      • 2023-03-25
      相关资源
      最近更新 更多