Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. import java.io.*;
  2. import com.microsoft.azure.storage.*;
  3. import com.microsoft.azure.storage.blob.*;
  4.  
  5. public class uploader {
  6. public static final String storageConnectionString =
  7. "DefaultEndpointsProtocol=http;"
  8. + "AccountName=portalvhds03hfwm6b73bhc;"
  9. + "AccountKey=hiim/TCRcG3tPvq/pWUX+qMCr/blxC0BmJjQw6DDn1XVXEaCXyXTzkSa55j3glKeTuCLVIAR9sEFnYRtbIuGCQ==";
  10. public static void main(String args[])throws IOException{
  11.  
  12. try {
  13. CloudStorageAccount account = CloudStorageAccount.parse(storageConnectionString);
  14. CloudBlobClient serviceClient = account.createCloudBlobClient();
  15.  
  16. // Container name must be lower case.
  17. CloudBlobContainer container = serviceClient.getContainerReference("newone");
  18. //container.createIfNotExists();
  19.  
  20. // Upload an image file.
  21. CloudBlockBlob blob = container.getBlockBlobReference("res.txt");
  22. File sourceFile = new File("E:\\FTPup\\op1.txt");
  23. blob.upload(new FileInputStream(sourceFile), sourceFile.length());
  24. }catch(Exception e)
  25. {
  26. System.out.println("Exception occured:" + e);
  27. }
  28. System.out.println("Connection success");
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement