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 7055979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:48:47+00:00 2026-05-28T03:48:47+00:00

I’m having an issue trying to directly upload a file to azure blob storage.

  • 0

I’m having an issue trying to directly upload a file to azure blob storage. I am using ajax calls to send post requests to an ashx handler to upload a blob in chunks. The issue I am running into is the handler isn’t receiving the filechunk being sent from the ajax post.

I can see the page is receiving the post correctly from looking at the request in firebug,

—————————–265001916915724 Content-Disposition: form-data; >name=”Slice”; filename=”blob” Content-Type: application/octet-stream

I noticed the input stream on the handler has the filechunk, including additional bytes from the request. I tryed to read only the filechunk’s size from the inputstream, however this resulted in an corrupt file.

I got the inspiration from http://code.msdn.microsoft.com/windowsazure/Silverlight-Azure-Blob-3b773e26 , I simply converted it from MVC3 to using standard aspx.

Here is the call using ajax to send the file chunk to the aspx page,

var sendFile = function (blockLength) {
var start = 0,
    end = Math.min(blockLength, uploader.file.size),
    incrimentalIdentifier = 1,
    retryCount = 0,
    sendNextChunk, fileChunk;
uploader.displayStatusMessage();
sendNextChunk = function () {
    fileChunk = new FormData();
    uploader.renderProgress(incrimentalIdentifier);
    if (uploader.file.slice) {
        fileChunk.append('Slice', uploader.file.slice(start, end));
    }
    else if (uploader.file.webkitSlice) {
        fileChunk.append('Slice', uploader.file.webkitSlice(start, end));
    }
    else if (uploader.file.mozSlice) {
        fileChunk.append('Slice', uploader.file.mozSlice(start, end));
    }
    else {
        uploader.displayLabel(operationType.UNSUPPORTED_BROWSER);
        return;
    }
    var testcode = 'http://localhost:56307/handler1.ashx?create=0&blockid=' + incrimentalIdentifier + '&filename=' + uploader.file.name + '&totalBlocks=' + uploader.totalBlocks;
    jqxhr = $.ajax({
        async: true,         
        url: testcode,
        data: fileChunk,
        contentType: false,
        processData:false,
        dataType: 'text json',          
        type: 'POST',
        error: function (request, error) {
            if (error !== 'abort' && retryCount < maxRetries) {
                ++retryCount;
                setTimeout(sendNextChunk, retryAfterSeconds * 1000);
            }

            if (error === 'abort') {
                uploader.displayLabel(operationType.CANCELLED);
                uploader.resetControls();
                uploader = null;
            }
            else {
                if (retryCount === maxRetries) {
                    uploader.uploadError(request.responseText);
                    uploader.resetControls();
                    uploader = null;
                }
                else {
                    uploader.displayLabel(operationType.RESUME_UPLOAD);
                }
            }

            return;
        },
        success: function (notice) {
            if (notice.error || notice.isLastBlock) {
                uploader.renderProgress(uploader.totalBlocks + 1);
                uploader.displayStatusMessage(notice.message);
                uploader.resetControls();
                uploader = null;
                return;
            }

            ++incrimentalIdentifier;
            start = (incrimentalIdentifier - 1) * blockLength;
            end = Math.min(incrimentalIdentifier * blockLength, uploader.file.size);
            retryCount = 0;
            sendNextChunk();
        }
    });
};

Thanks so much for anything that can help me out.

  • 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-05-28T03:48:48+00:00Added an answer on May 28, 2026 at 3:48 am

    Turns out on my webform, the input file tag was missing the enctype=”multipart/form-data” attribute.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to render a haml file in a javascript response like so:
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm trying to create an if statement in PHP that prevents a single post
I am using Paperclip to handle profile photo uploads in my app. They upload
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has

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.