Error when uploading file and getting the stream

Feb 2, 2010 at 10:24 AM

Hello there,

I have been using this control on a local environment and it works fine.

When I try the exact same code on a live environment I get the following error when uploading a file.

An error has occurred on **************.com

Page Location: /uploadimages.aspx?__ID=ctl00_ContentPlaceHolder1_FileUploader2&__AspCookie.Session=3t5dgg55gguqdvahqg0isv55&__AspCookie.Auth=6717BB6D89CED8345C56FA0A1609C1344F908DEE329747961FBF8A245F85F4BC22E87A1C9FC4513EDFBB24B7F23E7C974C0280B9080EE27DA541D3C34B25C2C740677797DC5D107A19624A39DC09B30F7FD5ED14D191D96925A57529C99457F0EF7743C9C08DE73A39AF21F8FA48E01F&&__index=0&__isLast=true

Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.

Source: System.Web

Method: Boolean HandleError(System.Exception)

Stack Trace: at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.uploadimages_aspx.ProcessRequest(HttpContext context) in c:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\df5871de\c27d3173\App_Web_tbfaym-l.0.cs:line 0 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

 

The code I am using is as follows.

<script type="text/javascript">
    function FileStateChanged(uploader, file, httpStatus, isLast)
    {
        Flajaxian.fileStateChanged(uploader, file, httpStatus, isLast);
        if (isLast)
        {
            setTimeout("window.location='yourphotos.aspx?page=1'", 2000);
        }
    }
    </script>

<fjx:FileUploader ID="FileUploader2" JsFunc_FileStateChanged="FileStateChanged" runat="server"
            OnFileReceived="FileUploader1_FileReceived" CssUrl="~/uploadimages.aspx" ProgressBarHeight="10"
            BrowseButtonY="20" UploadButtonY="20" CancelButtonY="20" Width="280" Height="70"
            BackColor="#eeeeee" BorderWidth="1" BorderColor="#333333" RequestAsPostBack="true"
            ClearListWhenQueueEnds="true">
            <Adapters>
                <fjx:FileSaverAdapter Runat="server" FolderName="TempFldr" />
            </Adapters>
        </fjx:FileUploader>

 

using System;
using System.Web.Security;

public partial class _UploadImages : PageBaseClass
{
    protected void Page_PreRender(object sender, EventArgs e)
    {
        hfUserId.Value = Membership.GetUser().ProviderUserKey.ToString();
    }

    protected void FileUploader1_FileReceived(object sender, com.flajaxian.FileReceivedEventArgs e)
    {
        Images Images1 = new Images();
        Images1.UserId = new Guid(hfUserId.Value);
        Images1.Title = string.Empty;
        Images1.Image = Utilities.ConvertStreamToByte(e.File.InputStream);

        // Get EXIF Data.
        Images1.GetExif();
        Images1.Insert();
    }
}

I don't understand what's happening. The above code writes to the database but it doesnt seem to be passing in the file stream.

Another note to make is that the physical file is uploading to the "TempFldr" folder. Very strange.

Any ideas anyone?

Thanks in advance.