我想做以下事情:
AppEngine需要生成一个URI来存储图像(我的猜测)
curl -i http://localhost:8082/upload_form
执行的代码是
^{pr2}$输出如下:
HTTP/1.1 200 OK
content-type: text/html; charset=utf-8
cache-control: no-cache
Content-Length: 115
Server: Development/2.0
Date: Fri, 06 Jun 2014 08:52:17 GMT
***http://localhost:8082/_ah/upload/ahNkZXZ-ZXZlbnRzcHVsc2UtZGV2ciILEhVfX0Jsb2JVcGxvYWRTZXNzaW9uX18YgICAgIDYtQoM***
然后我使用新的URL执行cURL:
curl -v -H 'Content-Type: multipart/form-data' -F "file=@./photofeed.png" http://localhost:8082/_ah/upload/ahNkZXZ-ZXZlbnRzcHVsc2UtZGV2ciILEhVfX0Jsb2JVcGxvYWRTZXNzaW9uX18YgICAgIDovQoM
以下是命令的输出:
* Adding handle: conn: 0x7fcb65021000
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7fcb65021000) send_pipe: 1, recv_pipe: 0
* About to connect() to localhost port 8082 (#0)
* Trying ::1...
* Connected to localhost (::1) port 8082 (#0)
> POST /_ah/upload/ahNkZXZ-ZXZlbnRzcHVsc2UtZGV2ciILEhVfX0Jsb2JVcGxvYWRTZXNzaW9uX18YgICAgIDovQoM HTTP/1.1
> User-Agent: curl/7.30.0
> Host: localhost:8082
> Accept: */*
> Content-Length: 2999
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=----------------------------76b075a1768d
>
< HTTP/1.1 100 Continue
< HTTP/1.1 404 Not Found
< Content-Length: 254
< Content-Type: text/html; charset=UTF-8
* Server Development/2.0 is not blacklisted
< Server: Development/2.0
< Date: Fri, 06 Jun 2014 08:54:38 GMT
* HTTP error before end of send, stop sending
<
<html>
<head>
<title>404 Not Found</title>
</head>
<body>
<h1>404 Not Found</h1>
The resource could not be found.<br /><br />
No such upload session: ahNkZXZ-ZXZlbnRzcHVsc2UtZGV2ciILEhVfX0Jsb2JVcGxvYWRTZXNzaW9uX18YgICAgIDovQoM
</body>
* Closing connection 0
也许上传网址已经过期了?它只在几分钟内有效。在
另请参见: google app engine; upload to blobstore gives 404 error
我在这里找到了部分答案:Using the Blobstore API with Google Cloud Storage
我需要专门在Google云存储中创建图像,我已经将CreateFile方法更改为CreateImage方法
相关问题 更多 >
编程相关推荐