Upload images-Call to a member function getClientOriginalExtension() on a non-object

1,472 views
Skip to first unread message

laureta xhaferaj

unread,
May 20, 2014, 8:13:21 AM5/20/14
to google-a...@googlegroups.com
I am developing my application with google app engine. I have a form which uploads images and saves path in database. I am deploying app with google app engine and upload of image doesn't works. Here is app.yaml
application: national-test
version: 1
runtime: php
api_version: 1

handlers:
- url: /favicon\.ico
  static_files: favicon.ico
  upload: favicon\.ico

- url: /(.+.(css|js|less|ico|png|jpg|woff|ttf|gif))$ 
  static_files: \1 
  upload: .+.(css|js|less|ico|png|jpg|woff|ttf|gif)$ 
  application_readable: true

- url: /.*
  script: public/index.php

and here is my laravel code which localy works well
  public function upload_image($id) {
            $file = Input::file('image');
            $destinationPath = 'uploads';
            $extension = $file->getClientOriginalExtension();
            
            $filename = time() . '' . str_random(6) . '.' . $extension;

            $file->move($destinationPath, $filename);
            $car = Car::find($id);
            $car->Pic = $destinationPath.$filename;
            $car->save();
    }
Uploaded images are saved inside public>uploads
Is the problem with file read? Or I am missing something in app.yaml config?

timh

unread,
May 21, 2014, 9:56:02 PM5/21/14
to google-a...@googlegroups.com
It has nothing to do with app.yaml/

You can not write the the filesystem in appengine.  Please read the docs on restrictions in the PHP runtime.
You will need to write these files to GCS.  

Reply all
Reply to author
Forward
0 new messages