DirectAmazonUploader and FileStateChanged Issue

Aug 17, 2009 at 12:17 AM

Hi,

I'm having an issue with manually changing the StatusCode in FileNameDeterming function and then displaying an error to the user. My code is

<fjx:FileUploader ID="AmazonUploadFileUploader" runat="server" ForeColor="Black" JsFunc_PositionFilesList="PositionFilesListFunc"
                        MaxFileSize="100MB" MaxFileSizeReachedMessage="Files must be smaller than {0} to upload."
                        MaxFileQueueSize="200MB" MaxFileQueueSizeReachedMessage="All the files can not be bigger than {0}."
                        JsFunc_FileStateChanged="FileStateChanged" IsDebug="true"
                        >
                    <Adapters>
                        <fjx:DirectAmazonUploader
                            AccessKey="WebConfig:AmazonAccessKey"
                            SecretKey="WebConfig:AmazonSecretKey"
                            BucketName="mybucketname"  
                            FileAccess="Private"
                            OnFileNameDetermining="AmazonUploadFileUploader_FileNameDetermining"
                            OnConfirmUpload="AmazonUploadFileUploader_ConfirmUpload"
                            ConfirmUploadJsFunc="ConfirmUploadJsFunc"
                            />
                    </Adapters>
                </fjx:FileUploader>  

--- Code Behind --

Protected Sub AmazonUploadFileUploader_FileNameDetermining(ByVal sender As Object, ByVal e As FileNameDeterminingEventArgs)

       e.CancelProcessing = True
        HttpContext.Current.Response.StatusCode = 550
    End Sub

--Java Script ---

function FileStateChanged(uploader, file, httpStatus, isLast){

    Flajaxian.fileStateChanged(uploader, file, httpStatus, isLast);
    if(httpStatus > 0)
    {
        alert(httpStatus);
    }

}

If i comment out the logic in the FileNameDetermining function, and upload a file, it alerts the correct status code (200 - saying it is OK).  Then when I uncomment the logic and try to upload the file, nothing happens and the file never gets uploaded and nothing is ever displayed.  There are no javascript errors on the browser.

I want to do this because I want to insert the filename into a database with other information, and if there is an error inserting, i want to throw an error, cancel the upload and display a message the user.  This seems like the ideal way to accomplish my task but can't seem to get it working.

any help would be appreciated.