App Engine PHP上传文件 [英] App Engine PHP upload file

查看:157
本文介绍了App Engine PHP上传文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图弄清楚如何正确地将我的文件上传到Google App Engine。如果我为名为images的静态目录声明一个处理程序 - 没有需要上载语句 - 但是如果我尝试使用正则表达式仅上载Web图形,则文件(显然)不会上载。



这是我的app.yaml:

  application:static-files -demo-999 
版本:1
运行时:php
api_version:1

处理程序:
- url:/ styles
static_dir:样式

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

- url:/.*
script:main.php
pre>

据我所知,就像文档所说的,只是针对我的图片文件夹。任何人都可以发现我做错了什么?



非常感谢!



Best - Joe

解决方案

解决了它。我在字面上遵循了文档,包括我的路径中的静态文件夹。这是正确的代码:

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

希望这会阻止其他人犯同样的错误。




  • Joe li>

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

解决方案

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

这篇关于App Engine PHP上传文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆