I am using web api. I want to store file which is stored in filepath. This code works well in my local pc. But when i deployed this code in Server. It is not working. Is there any way to save file from other PCs as well???
string tempPath = Path.Combine(strPath + AttachmentFileName);
string filePath = Path.Combine(tempPath);
string S3_KEY = key;
string S3BucketName = Convert.ToString(ConfigurationManager.AppSettings["BucketName"]);
FileStream stream = new FileStream(filePath, FileMode.Open);
PutObjectRequest objReq = new PutObjectRequest
{
Key = AttachmentFileName,
InputStream = stream,
BucketName = S3BucketName + "/" + S3_KEY,
CannedACL = S3CannedACL.Private,
Timeout = 3600000
};
PutObjectResponse response = s3Client.PutObject(objReq);
objMessage.Attachments.Add(new Attachment(AttachmentFileName));
//stream.Flush();
//stream.Dispose();
response.Dispose();
Aucun commentaire:
Enregistrer un commentaire