问题
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