Google app engine doesn't uploads images

189 views
Skip to first unread message

laureta xhaferaj

unread,
May 20, 2014, 6:14:41 AM5/20/14
to google-a...@googlegroups.com

Hello! I am using laravel  4 to build my application. I have created a form to upload images. Localy everything works, I can upload images and save path in database. The problem is when update application in google app engine. It doesn't gets the image , because I try: $file = Input::file('image'); var_dump($file); and it displays NULL. I save images inside public>assets>uploads>images. May the problem be with app.yaml? This is my 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

Vinny P

unread,
May 21, 2014, 11:02:02 PM5/21/14
to google-a...@googlegroups.com
On Tue, May 20, 2014 at 5:14 AM, laureta xhaferaj <laur...@gmail.com> wrote:
I have created a form to upload images. Localy everything works, I can upload images and save path in database. The problem is when update application in google app engine. It doesn't gets the image , because I try: $file = Input::file('image'); var_dump($file); and it displays NULL. I save images inside public>assets>uploads>images. May the problem be with app.yaml?


You shouldn't need to be saving those files yourself. Use App Engine's createUploadUrl to handle the file upload and saving.

Also, you're attempting to write to the local file system; you can't do that on App Engine. You need to be writing to Cloud Storage (the createUploadUrl method will automatically handle that). 
 
 
-----------------
-Vinny P
Technology & Media Advisor
Chicago, IL

App Engine Code Samples: http://www.learntogoogleit.com

laureta xhaferaj

unread,
Jun 27, 2014, 7:11:11 AM6/27/14
to google-a...@googlegroups.com
I just read your answer. I know that I should use  createUploadUrl  but this creates problem with routes and post from view to controller in laravel. Here is my question in SO http://stackoverflow.com/questions/24438218/laravel-4-methodnotallowedhttpexception-on-form-post and as you can see it just stores images in GS but I can't pass data from view to controller. Could you help me? What alternative solutions do I have?
Reply all
Reply to author
Forward
0 new messages