[英]Google App Engine PHP: Multiple file upload
有沒有一種方法可以在一個請求中允許多個文件上傳到Google App Engine? 該指南使我相信您可以,但是我復制了該演示,它似乎對我不起作用。
app.yaml
application: splink-api
runtime: php55
api_version: 1
default_expiration: "1h"
handlers:
- url: /handle_upload
script: handle_upload.php
- url: /direct_upload
script:direct_upload.php
direct_upload.php
<?php
// Direct uploads requires PHP 5.5 on App Engine.
if (strncmp("5.5", phpversion(), strlen("5.5")) != 0) {
die("Direct uploads require the PHP 5.5 runtime. Your runtime: " . phpversion());
}
?>
<html>
<body>
<form action="handle_upload" method="post" enctype="multipart/form-data">
Send these files:<p/>
<input name="userfile[]" type="file" multiple="multiple"/><p/>
<input type="submit" value="Send files" />
</form>
</body>
</html>
handle_upload.php
<?php
header('Content-Type: text/plain');
print_r($_FILES);
結果是:
Array
(
[userfile] => Array
(
[name] => Array
(
[0] => arryn.jpg
)
[type] => Array
(
[0] => image/jpeg
)
[tmp_name] => Array
(
[0] => vfs://root/uploads/0
)
[error] => Array
(
[0] => 0
)
[size] => Array
(
[0] => 721332
)
)
)
使用具有相同代碼的簡單php服務器會導致:
Array
(
[userfile] => Array
(
[name] => Array
(
[0] => arryn.jpg
[1] => baratheon.jpg
)
[type] => Array
(
[0] => image/jpeg
[1] => image/jpeg
)
[tmp_name] => Array
(
[0] => /private/var/folders/rc/z5ky3d3s29v0bsdllnzvpj8r0000gn/T/phpUt5H8S
[1] => /private/var/folders/rc/z5ky3d3s29v0bsdllnzvpj8r0000gn/T/phpijjaNO
)
[error] => Array
(
[0] => 0
[1] => 0
)
[size] => Array
(
[0] => 721332
[1] => 234717
)
)
)
在日志中看不到任何錯誤,我已經嘗試使用很小的文件,所以這不應該成為問題。 在開發服務器上進行本地測試。 有任何想法嗎?
在php.ini
我需要更改
max_file_uploads: 1
至
max_file_uploads: 100
我看過的任何演示或文檔中都沒有很好地記錄下來。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.