2016-11-21 27 views
0

我在我的 laravel項目中使用了這個https://github.com/softlayer/softlayer-object-storage-php當我上傳文件到softlayer對象存儲時,我收到了一些錯誤信息

我會打電話給

$newObject = $objectStorage->with('mycontainer/path/test.png') 
         ->setLocalFile('C:/Users/XXX/Downloads/Great-Impression.jpg') 
         ->setMeta('description', 'first test file') 
         ->create(); 

我得到了一些消息錯誤

ObjectStorage_Exception_Http_RequestTimeout in D:\Works\mytest\vendor\softlayer\objectstorage\lib\ObjectStorage.php line 552: 

無法創建ObjectStorage對象。

但是當我刪除->setLocalFile('C:/Users/XXX/Downloads/Great-Impression.jpg')它工作正常。

請告知如何解決此錯誤。

感謝

回答

0

我無法重現您的問題,他的代碼,它的罰款,反正我這個嘗試:

<?php 
require_once ('lib/ObjectStorage/Util.php'); 

/** 
* Declare Object Storage parameters 
*/ 
$host = 'https://mil01.objectstorage.softlayer.net/auth/v1.0/'; 
// Declare your username and password for Object Storage connection 
$username = 'set me'; 
$password = 'set me'; 
$options = array('adapter' => ObjectStorage_Http_Client::SOCKET, 'timeout' => 10); 

/** 
* Create Object Storage Connection 
*/ 
$objectStorage = new ObjectStorage($host, $username, $password, $options); 

/** 
* Upload file 
*/ 
$newObject = $objectStorage->with('mycontainer/path/test.png') 
         ->setLocalFile('C:/Users/Ruber Cuellar/Pictures/test.jpg') 
         ->setMeta('description', 'first test file') 
         ->create(); 
// Print Result  
print($newObject);   

你能提供有關此問題的詳細信息?

  • 您嘗試過的羣集(數據中心)?
  • 是否可以將此文件上傳到其他羣集(其他數據中心)?
  • 你用另一張圖片試過了嗎?
+0

您嘗試過的羣集(數據中心)? - 我用新加坡1 你能上傳這個文件到其他羣集(其他數據中心)嗎? - 我改變了羣集到米蘭1,就像你無法上傳。 你用另一張圖片試過了嗎? - 是的,我也無法上傳。 – iPreaw

+0

奇怪的是,我嘗試過新加坡,我也有成功。你有沒有在你的對象存儲中創建這個路徑** mycontainer/path **,你是否可以創建另一個請求,如創建或獲取容器? –

+0

我不確定爲什麼我昨天無法上傳。但今天我再次測試它的工作!謝謝。 – iPreaw

相關問題