七牛雲端儲存 - 用php上傳圖片,我在本地測試,用php 介面,不成功

來源:互聯網
上載者:User
七牛反饋顯示資訊說明已經成功了,但是在七牛空間顯示的檔案卻不完整

請問這是為什麼啊?!!測試檔案如下,本地localhost測試:

require_once("qiniu/io.php");require_once("qiniu/rs.php");$bucket = "qicheshipin";$key1 = "950.jpg";$accessKey = '我的key';$secretKey = '我的key';Qiniu_SetKeys($accessKey, $secretKey);$putPolicy = new Qiniu_RS_PutPolicy($bucket);$upToken = $putPolicy->Token(null);$putExtra = new Qiniu_PutExtra();$putExtra->Crc32 = 1;list($ret, $err) = Qiniu_PutFile($upToken, $key1, __file__, $putExtra);echo "====> Qiniu_PutFile result: \n";if ($err !== null) {    var_dump($err);} else {    var_dump($ret);}

返回資料:

Qiniu_PutFile result: array(2) { ["hash"]=> string(28) "Fk4xlsc7g7urp1VfwkBZv7UCjyqC" ["key"]=> string(7) "950.jpg" }

回複內容:

七牛反饋顯示資訊說明已經成功了,但是在七牛空間顯示的檔案卻不完整

請問這是為什麼啊?!!測試檔案如下,本地localhost測試:

require_once("qiniu/io.php");require_once("qiniu/rs.php");$bucket = "qicheshipin";$key1 = "950.jpg";$accessKey = '我的key';$secretKey = '我的key';Qiniu_SetKeys($accessKey, $secretKey);$putPolicy = new Qiniu_RS_PutPolicy($bucket);$upToken = $putPolicy->Token(null);$putExtra = new Qiniu_PutExtra();$putExtra->Crc32 = 1;list($ret, $err) = Qiniu_PutFile($upToken, $key1, __file__, $putExtra);echo "====> Qiniu_PutFile result: \n";if ($err !== null) {    var_dump($err);} else {    var_dump($ret);}

返回資料:

Qiniu_PutFile result: array(2) { ["hash"]=> string(28) "Fk4xlsc7g7urp1VfwkBZv7UCjyqC" ["key"]=> string(7) "950.jpg" }

上面的結果應該是證明檔案已經傳成功了。"在七牛空間顯示的檔案卻不完整" 是指什嗎?通過 http://qicheshipin.u.qiniudn.com/950.jpg 可以訪問到這個檔案嗎?另外,在上傳成功後有沒有做過其他事情,比如 delete 這個檔案?

搞定了,Qiniu_PutFile函數第三個參數預設使用file,修改為上傳檔案本地絕對路徑後成功!

求大神幫忙
http://segmentfault.com/q/1010000000343075#a-1020000000345187

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.