Copy File Introduction
This API allows you to copy a file on the Aspose Cloud Storage.
API Explorer
Aspose.Storage Cloud API Reference lets you try out Copy File API right away in your browser! It allows you to effortlessly interact and try out every single operation our APIs exposes. Please check this article to learn how to get your App Key and SID.
cURL Example
SDKs
Our API is completely independent of your operating system, database system or development language. You can use any language and platform that supports HTTP to interact with our API. However, manually writing client code can be difficult, error-prone and time-consuming. Therefore, we have provided and support API SDKs in many development languages in order to make it easier to integrate with us. If you use SDK , it hides the REST API calls and lets you use Aspose.Storage features in a native way for your preferred language.
SDK Examples
C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-storage-cloud/aspose-storage-cloud-dotnet
// Get App Key and App SID from https://dashboard.aspose.cloud/
var configuration = new Configuration { AppSid = "xxxxxxxx", AppKey = "xxxxxxxx" };
StorageApi storageApi = new StorageApi(configuration);
PutCopyRequest request = new PutCopyRequest();
request.Path = "test_multi_pages.docx";
request.Storage = null;
request.VersionId = null;
request.Newdest = Path.Combine("Documents", "test_multi_pages.docx");
request.DestStorage = null;
var response = storageApi.PutCopy(request);
Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-storage-cloud/aspose-storage-cloud-java/
// Get App Key and App SID from https://dashboard.aspose.cloud/
StorageApi api = new StorageApi("https://api.aspose.cloud/v1.1", "xxxxx", "xxxxx");
String path = "testfile.txt";
String newdest = new File("Documents/", "/testfile.txt").getPath();
String versionId = null;
String storage = null;
String destStorage = null;
ResponseMessage response = api.PutCopy(path, newdest, versionId, storage, destStorage);
PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-storage-cloud/aspose-storage-cloud-php
<?php
require_once realpath(__DIR__ . '/..') . '/vendor/autoload.php';
use Aspose\Storage\Configuration;
use Aspose\Storage\Api\StorageApi;
use Aspose\Storage\Model\Requests;
class File {
public $storageApi;
public function __construct() {
$config = new Configuration();
// Get App Key and App SID from https://dashboard.aspose.cloud/
$config->setAppKey('')->setAppSid('');
$this->storageApi = new StorageApi($config);
}
public function copyFile() {
$path = "testfile.txt";
$newdest = "Documents/testfile.txt";
$versionId = null;
$storage = null;
$destStorage = null;
$request = new Requests\PutCopyRequest($path, $newdest, $versionId, $storage, $destStorage);
$result = $this->storageApi->putCopy($request);
}
}
$file = new File();
$file->copyFile();
?>
Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-storage-cloud/aspose-storage-cloud-ruby
require 'aspose_storage_cloud'
class Storage
include AsposeStorageCloud
def initialize
#TODO: Get your AppSID and Appkey from https://dashboard.aspose.cloud
AsposeStorageCloud.configure do |config|
config.api_key['api_key'] = ''
config.api_key['app_sid'] = ''
end
@storage_api = StorageApi.new
end
def copy_file
path = 'testfile.txt'
newdest = 'Documents/testfile.txt'
versionId = nil
storage = nil
destStorage = nil
request = PutCopyRequest.new(path, newdest, versionId, storage, destStorage)
result = @storage_api.put_copy(request)
end
end
storage = Storage.new()
puts storage.copy_file
Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-storage-cloud/aspose-storage-cloud-python
import os
import asposestoragecloud
from asposestoragecloud.apis.storage_api import StorageApi
from asposestoragecloud.api_client import ApiClient
class File(object):
def __init__(self):
ABSPATH = os.path.abspath(os.path.realpath(os.path.dirname(__file__)) + "/..")
self.dataFolder = os.path.join(ABSPATH, "Data")
# Get App Key and App SID from https://dashboard.aspose.cloud/
self.apiClient = ApiClient(apiKey='xxxxxxxx', appSid='xxxx-xxxx-xxxx-xxxx-xxxx')
self.api = asposestoragecloud.apis.storage_api.StorageApi(self.apiClient)
def copyFile(self):
path = "testfile.txt"
newdest = os.path.join("My Documents", "testfile.txt")
response = self.api.put_copy(path, newdest)
file = File()
file.copyFile()