Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8942121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:27:03+00:00 2026-06-15T11:27:03+00:00

I’m trying to fix a bug where the following code results in a 0

  • 0

I’m trying to fix a bug where the following code results in a 0 byte file on S3, and no error message.

This code feeds in a Stream (from the poorly-named FileUpload4) which contains an image and the desired image path (from a database wrapper object) to Amazon’s S3, but the file itself is never uploaded.

CloudUtils.UploadAssetToCloud(FileUpload4.FileContent, ((ImageContent)auxSRC.Content).PhysicalLocationUrl);
ContentWrapper.SaveOrUpdateAuxiliarySalesRoleContent(auxSRC);

The second line simply saves the database object which stores information about the (supposedly) uploaded picture. This save is going through, demonstrating that the above line runs without error.

The first line above calls in to this method, after retrieving an appropriate bucketname:

public static bool UploadAssetToCloud(Stream asset, string path, string bucketName, AssetSecurity security = AssetSecurity.PublicRead)
{
    TransferUtility txferUtil;
    S3CannedACL ACL = GetS3ACL(security);

    using (txferUtil = new Amazon.S3.Transfer.TransferUtility(AWSKEY, AWSSECRETKEY))
    {
        TransferUtilityUploadRequest request = new TransferUtilityUploadRequest()
            .WithBucketName(bucketName)
            .WithTimeout(TWO_MINUTES)
            .WithCannedACL(ACL)
            .WithKey(path);
        request.InputStream = asset;
        txferUtil.Upload(request);
    }

    return true;
}

I have made sure that the stream is a good stream – I can save it anywhere else I have permissions for, the bucket exists and the path is fine (the file is created at the destination on S3, it just doesn’t get populated with the content of the stream). I’m close to my wits end, here – what am I missing?

EDIT: One of my coworkers pointed out that it would be better to the FileUpload’s PostedFile property. I’m now pulling the stream off of that, instead. It still isn’t working.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T11:27:04+00:00Added an answer on June 15, 2026 at 11:27 am

    Is the stream positioned correctly? Check asset.Position to make sure the position is set to the beginning of the stream.

    asset.Seek(0, SeekOrigin.Begin);
    

    Edit

    OK, more guesses (I’m down to guesses, though):
    (all of this is assuming that you can still read from your incoming stream just fine “by hand”)

    1. Just for testing, try one of the simpler Upload methods on the TransferUtility — maybe one that just takes a file path string. If that works, then maybe there are additional properties to set on the UploadRequest object.

    2. If you hook the UploadProgressEvent on the UploadRequest object, do you get any additional clues to what’s going wrong?

    3. I noticed that the UploadRequest’s api includes both an InputStream property, and a WithInputStream fluent API. Maybe there’s a bug with setting InputStream? Maybe try using the .WithInputStream API instead

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to render a haml file in a javascript response like so:
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Does anyone know how can I replace this 2 symbol below from the string
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.