App Engine PHP upload file

时光怂恿深爱的人放手 提交于 2019-12-13 04:29:19

问题


I'm trying to figure out how to upload my files correctly to Google App Engine. Everything works if I declare a handler for a static directory named images - there's no upload statement needed - but if I try to use regex to upload only web graphics, the files (evidently) aren't uploaded.

Here's my app.yaml:

application: static-files-demo-999
version: 1
runtime: php
api_version: 1

handlers:
- url: /styles
  static_dir: styles

- url: /images/(.*\.(gif|png|jpg))
  static_files: static/images/\1
  upload: images/(.*\.(gif|png|jpg))

- url: /.*
  script: main.php

As far as I can tell, it's exactly like the docs say, just targeting my images folder. Can anyone spot what I'm doing wrong?

Much appreciated!

Best - Joe


回答1:


Solved it. I was following the documentation too literally and including the static folder in my path. Here's the correct code:

- url: /images/(.*\.(gif|png|jpg))
  static_files: images/\1
  upload: images/(.*\.(gif|png|jpg))

Hopefully this will stop others from making the same (bonehead) mistake.

  • Joe


来源:https://stackoverflow.com/questions/19939866/app-engine-php-upload-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!