我正在使用 spring MVC 创建我的项目 webapp。我想要的是如何在我的 Windows azure 帐户 CDN(内容交付网络)上上传图像?
问问题
1138 次
2 回答
0
// You will need these imports
import com.microsoft.windowsazure.services.blob.client.CloudBlobClient;
import com.microsoft.windowsazure.services.blob.client.CloudBlobContainer;
import com.microsoft.windowsazure.services.blob.client.CloudBlockBlob;
import com.microsoft.windowsazure.services.core.storage.CloudStorageAccount;
// Initialize Account
CloudStorageAccount account = CloudStorageAccount.parse([ACCOUNT_STRING]);
// Create the blob client
CloudBlobClient blobClient = account.createCloudBlobClient();
// Retrieve reference to a previously created container
CloudBlobContainer container = blobClient.getContainerReference("mycontainer");
// Create or overwrite the "myimage.jpg" blob with contents from a local
// file
CloudBlockBlob blob = container.getBlockBlobReference("myimage.jpg");
File source = new File("c:\\myimages\\myimage.jpg");
blob.upload(new FileInputStream(source), source.length());
Source : http://blogs.msdn.com/b/windowsazurestorage/archive/2012/03/05/windows-azure-storage-client-for-java-overview.aspx
于 2014-06-03T05:07:56.120 回答
0
这就是你要找的东西?
于 2014-06-03T04:29:36.453 回答