7
我使用狂飲有上傳大文件的問題(5.2.0)似乎無法上傳用PHP大文件狂飲
我添加了進度事件偵聽器,並得到這樣的輸出:
Downloaded 0 of 0 Uploaded 966656 of 1467594
Downloaded 0 of 0 Uploaded 983040 of 1467594
Downloaded 0 of 0 Uploaded 999424 of 1467594
Downloaded 0 of 0 Uploaded 1015808 of 1467594
Downloaded 0 of 0 Uploaded 1032192 of 1467594
Downloaded 0 of 0 Uploaded 1048576 of 1467594
Downloaded 0 of 0 Uploaded 1064960 of 1467594
Downloaded 0 of 0 Uploaded 1081344 of 1467594
Downloaded 0 of 0 Uploaded 1097728 of 1467594
Downloaded 0 of 0 Uploaded 1114112 of 1467594
Downloaded 0 of 0 Uploaded 1130496 of 1467594
Downloaded 0 of 0 Uploaded 1146880 of 1467594
Downloaded 0 of 0 Uploaded 1146880 of 1467594
Downloaded 0 of 0 Uploaded 1146880 of 1467594
Downloaded 0 of 0 Uploaded 1146880 of 1467594
Downloaded 0 of 0 Uploaded 1146880 of 1467594
Downloaded 0 of 0 Uploaded 1146880 of 1467594
Downloaded 0 of 0 Uploaded 1146880 of 1467594
Downloaded 0 of 0 Uploaded 1146880 of 1467594
Downloaded 0 of 0 Uploaded 1146880 of 1467594
Downloaded 0 of 0 Uploaded 1146880 of 1467594
Downloaded 0 of 0 Uploaded 1146880 of 1467594
Downloaded 0 of 0 Uploaded 1146880 of 1467594
Downloaded 0 of 0 Uploaded 1146880 of 1467594
它似乎每次都陷入1146880字節,掛起,然後命中curl超時。
這裏是我如何格式化狂飲要求:
$client = new \GuzzleHttp\Client();
$endpoint = 'http://myendpoint.com'
$file = new splfileobject('/path/to/file')
$options = [
"body" => [
"file" => fopen($file->getRealPath(), 'r')
]
]
$client->post($endpoint, $options);
當我切換到使用原始捲曲,我可以上傳使用「@filename」語法的形象。
任何想法?謝謝 !
僅供參考我有我的php.ini post_max_size和upload_max_filesize都設置爲50米 – mikeklein
可能的重複http://stackoverflow.com/questions/32359664/guzzle-5-3-unable-to-post-json-body-if -larger高於1MB。 – localheinz