Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AjaxControlToolkit's AsyncFileUpload misbehaving when deployed online

In case it matters, the following is inside a toolkit popup, which has an update panel in it.

<p>
    <asp:Label Text="Picture" runat="server" Width="75"></asp:Label>
    <ajaxToolkit:AsyncFileUpload ID="MediaPicture" runat="server" Width="200"
        OnClientUploadStarted="BlockSubmits" ClientIDMode="AutoID"
        OnClientUploadError="UnblockSubmits" PersistFile="true"
        OnClientUploadComplete="UnblockSubmits" 
    />
</p>

The javascript functions just block / release a submit button, to prevent problems during uploads.

This works fine on localhost, but when deployed online on a GoDaddy server, I can't seem to upload files over a few KB, even when locally I could upload bigger files (~2MB)...

I can't seem to find the reason for this behavior, could it be on the IIS? I read something about the app pool clearing before the upload could complete, could this be happening?

Btw, just in case, server-side I just take the picture out of this control

byte[] picture = MediaPicture.FileBytes ?? (string.IsNullOrEmpty(mediaID) ? null : Media.SelectByID(int.Parse(mediaID)).GetPicture());

There's some extra logic in there about whether I'm in edit mode or not, and if the current record has a picture, I'll take that over no picture,

And then I store it on the database.

any thoughts as to why this might be happening?

thanks!

like image 951
bevacqua Avatar asked Dec 03 '25 06:12

bevacqua


1 Answers

If I understand your situation correctly, the problem is caused by the AsyncFileUpload being located inside the updatepanel, thereby having the file upload happen during a postback...

This blog post has a decent explanation of why.

As for why it works locally, if it is the problem as explained above, it's because of the way the browser handles "local" from "internet" domains.

like image 101
Dekker500 Avatar answered Dec 05 '25 22:12

Dekker500



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!