Click here to Skip to main content
15,881,281 members
Articles / Programming Languages / C
Tip/Trick

Amazon S3 .lib/Dll for Uploading File with Signature Version 4 for VS2010 in C++

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
14 Feb 2016CPOL 13.3K   259   4  
Amazon S3 lib for uploading file in C++ using VS2010

Introduction

Amazon has provided C++ SDK for uploading files to S3 for which you need VS2013. I had made a library project for uploading file to Amazon S3 cloud for Visual Studio 2010 and above using lib CURL. You can use as a .lib or DLL in your project.

Background

Currently, Amazon has provided C++ SDK for Visual Studio 2013. I have made lib for uploading files to Amazon S3 using LIB Curl in Visual Studio 2010. You can extend/modify the library to create, delete , get list of bucket and downloading the file for your Amazon account.

Using the Code

You need to include AmazonS3Upload.h header file and .lib/DLL in your project.

All you need is to provide the below details:

C++
string FilePathToUpload = "c:\songs.mp3";
string bucketName = "mybucket";
string regionUrlPart = "us-east-1";
    
string FilePathAtAmazon = "foldername\";    
string contentType = "media/mpeg";
string strAccesskey = "adasdafas234324";
string strSecretKey = "fgfwt2t2ttertert";

// Use this method to set parameter

pCloudUploadInterface->InitParamenters(FilePathToUpload, bucketName, 
REGION_US_SA_EAST_1, FilePathAtAmazon, contentType, strAccesskey, strSecretKey);

 //To upload file just call the UploadFile().
 int eErrorCode = pCloudUploadInterface->UploadFile();

If ErrorCode 0 means success and other for failure.

On error, you need to call (pCloudUploadInterface->getError())) to get last error details.

This is just an example to upload your files.

You can modify S3Sdk project according to your requirement like getting list of bucket, creating, deleting bucket,setting permission to bucket and downloading file from bucket.

Note: Compile in release mode only.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --