I am using laravel 4 and I am trying to upload images into a folder and save the name in database. I have addad my application in Google App Engine, localy image upload is working well but when update app engine online, it shows this error after submit of image:
Symfony \ Component \ Debug \ Exception \ FatalErrorException Call to a member function getClientOriginalExtension() on a non-object
CarController.php
public function upload_image($id) {
$file = Input::file('image');
$destinationPath = 'uploads/images/';
$extension = $file->getClientOriginalExtension();
$filename = time() . '' . str_random(6) . '.' . $extension;
$file->move($destinationPath, $filename);
}
routes.php
Route::post('upload/image/{id}', array('as' => 'upload.image', 'uses' => 'CarController@upload_image'));
upload_images.blade.php
{{ Form::file('image') }}
<br>
{{ Form::submit('Add Photo', array('class' => 'btn btn-primary' )) }}
{{ Form::close() }}
and when update my applicaion by cp it shows this : Could not guess mimetype for public/uploads/images/1400508710-png. Using applic ation/octet-stream. Could not guess mimetype for public/uploads/images/1400509034-png. Using applic ation/octet-stream.
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