I am download image from amazon s3 bucket to my local memory stream. When it is download then I have upload image with text in twitter using Tweet-Sharp dll.
When I was using local image with upload then it is working fine. If I am using amazon bucket file then it is not uploaded.
Here is my code
string fileName = Path.GetFileName(Convert.ToString(socialMediashareProduct["ProductPath"])); //Path.GetFileName(socialMediashareProduct.ProductPath);
Stream fileStream = CommonFunctions.GetImageinS3Bucket(CommonFunctions.ProductImages, CommonFunctions.Thumbnail, "T_" + fileName); //File.Open(Convert.ToString(socialMediashareProduct["ProductPath"]), System.IO.FileMode.Open, System.IO.FileAccess.Read); //File.Open(socialMediashareProduct.ProductPath, System.IO.FileMode.Open, System.IO.FileAccess.Read);
tempDisctionary.Add(fileName, fileStream);
string hostName = CommonFunctions.ReturnHostName();
string callBackUrl = hostName + Path.AltDirectorySeparatorChar + "Default.aspx"; //Path.Combine(hostName, "Default.aspx");
string tempString = string.Empty;
tempString += Convert.ToString(socialMediashareProduct["ProductName"]);
tempString += " This item is provided by " + Convert.ToString(socialMediashareProduct["BrandPartnerName"]) + " through ClosetAuction.com";
tempString += " Yay! I earned ponts!";
UploadMediaOptions uplodMedia = new UploadMediaOptions
{
Media = new MediaFile
{
Content = fileStream,
FileName = fileName
}
};
TwitterUploadedMedia uploadDedMedia = service.UploadMedia(uplodMedia);
if (uploadDedMedia != null)
{
if (!string.IsNullOrEmpty(uploadDedMedia.Media_Id))
{
SendTweetOptions sendTweetOption = new SendTweetOptions
{
Status = Convert.ToString(tempString),
MediaIds = new List<string>() { uploadDedMedia.Media_Id },
};
TwitterStatus twitterStatus = service.SendTweet(sendTweetOption);
}
}
"uploadDedMedia" object is always null. Any one help me.
Aucun commentaire:
Enregistrer un commentaire