5
A
回答
3
使用CF_Container的delete_object方法。
0
這是我在C#中的代碼。只是猜測的API是相似的PHP。
UserCredentials userCredientials = new UserCredentials("xxxxxx", "99999999999999");
cloudConnection = new Connection(userCredientials);
cloudConnection.DeleteStorageItem(ContainerName, fileName);
0
確保您設置容器並定義您正在使用的任何sudo文件夾。
$my_container = $this->conn->get_container($cf_container);
//delete file
$my_container->delete_object($cf_folder.$file_name);
0
我想我會在這裏發佈,因爲沒有標記爲一個正確的答案,但我會接受馬修•富蘭琛答案正確的。這將是所有你需要刪除的文件
<?php
require '/path/to/php-cloudfiles/cloudfiles.php';
$username = 'my_username';
$api_key = 'my_api_key';
$full_object_name = 'this/is/the/full/file/name/in/the/container.png';
$auth = new CF_Authentication($username, $api_key);
$auth->ssl_use_cabundle();
$auth->authenticate();
if ($auth->authenticated())
{
$this->connection = new CF_Connection($auth);
// Get the container we want to use
$container = $this->connection->get_container($name);
$object = $container->delete_object($full_object_name);
echo 'object deleted';
}
else
{
throw new AuthenticationException("Authentication failed") ;
}
注意的「$ full_object_name」包括「路徑」,以在容器中的文件,並沒有最初的「/」的文件名中的代碼。這是因爲容器使用僞分層文件夾/目錄以及容器中文件的名稱是路徑+文件名。更多信息請參見http://docs.rackspace.com/files/api/v1/cf-devguide/content/Pseudo-Hierarchical_Folders_Directories-d1e1580.html
0
從類CF_Container使用名爲DeleteObject的的方法。
CF_Container的DeleteObject方法只需要一個字符串參數object_name。 這個參數應該是要刪除的文件名。
參見下文的例子C#代碼:
string username = "your-username";
string apiKey = "your-api-key";
CF_Client client = new CF_Client();
UserCredentials creds = new UserCredentials(username, apiKey);
Connection conn = new CF_Connection(creds, client);
conn.Authenticate();
var containerObj = new CF_Container(conn, client, container);
string file = "filename-to-delete";
containerObj.DeleteObject(file);
注意鴕鳥政策使用DeleteObject的從類* CF_Client *
相關問題
- 1. 如何使用Rackspace CloudFiles .NET API設置文件過期標題
- 2. 如何使用Rackspace CloudFiles設置文件過期標題PHP API
- 3. 如何使用openstack.net在Rackspace上從CloudFiles獲取jpg文件
- 4. Rackspace cloudfiles API相當慢
- 5. 使用RackSpace Cloudfiles與Paperclip gem
- 6. Rackspace CloudFiles:檢查文件的存在
- 7. 使用C#API從Rackspace CloudFiles CDN啓用容器檢索圖像
- 8. rackspace cloudfiles api - 返回容器文件的最有效方法
- 9. 如何使用boto將文件從Amazon S3流式傳輸到Rackspace Cloudfiles?
- 10. PHP - Rackspace公司CloudFiles API檢查文件路徑已經存在?
- 11. RackSpace CloudFiles如何使用異步或隊列發送文件使用C#
- 12. 阿帕奇LibCloud和Rackspace Cloudfiles
- 13. 如何使用java api從Dropbox中刪除文件/文件夾?
- 14. 如果在Rackspace Cloudfiles中刪除圖像,則會顯示默認圖像?
- 15. 如何刪除文件從RackSpace Cloud使用Asp.Net一段時間後?
- 16. 如何使用Win32 API從INI文件中刪除一段?
- 17. 如何使用API從Basecamp中刪除文件?
- 18. 使用GRAPH API從Sharepoint刪除文件
- 19. 如何從我的網站中刪除未使用的文件
- 20. 如何爲存儲在Rackspace CloudFiles上的文件生成縮略圖
- 21. 我如何使用htaccess從url中刪除用戶文件夾
- 22. 爲Rackspace公司cloudfiles(EU)與回形針
- 23. Rackspace Cloudfiles Rails send_file替代方案
- 24. Rails +回形針+ Rackspace CloudFiles私人CDN
- 25. RackSpace Cloudfiles api錯誤'未定義偏移量:8'
- 26. 如何使用javascript從文件夾中刪除文件?
- 27. 如何使用PHP從文件夾中刪除文件
- 28. 如何使用Eventbrite API刪除事件?
- 29. 我如何刪除文件
- 30. 如何防止我的用戶從iPod中刪除MP3文件