httpStatus is not being set

May 30, 2009 at 12:58 AM

Hello Flajaxian,

I'm using the same concept as explained in the Help file...

script runat="server">
protected void FileNameDetermining(object sender, FileNameDeterminingEventArgs args)
{
    if(<some condition = true>){
      args.CancelProcessing = true;
      HttpContext.Current.Response.StatusCode = 550;
    }
}
</script>
<script>
function FileStateChanged(uploader, file, httpStatus, isLast){
    Flajaxian.fileStateChanged(uploader, file, httpStatus, isLast);
    if(httpStatus == 550){
        uploader.cancel();
        alert("<Message>");
    }
}
</script>
<fjx:FileUploader ID="FileUploader1" RequestAsPostBack="true" JsFunc_FileStateChanged="FileStateChanged" runat="server">
    <Adapters>
        <fjx:FileSaverAdapter Runat="server" FolderName="UploadFolder" OnFileNameDetermining="FileNameDetermining" />
    </Adapters>
</fjx:FileUploader>

But somehow the StatusCode isn't being set to 550 and as a result it does not go through the IF condition in FileStateChanged that alerts <Message> to the user...

Please advise...

Jun 8, 2009 at 5:44 PM

Any updates to this? Can anyone help me with this...

Coordinator
Jun 8, 2009 at 6:19 PM

When I test your example I am getting the error message alert. Check this part of your code

 if(<some condition = true>){

may be it is always false?

Jun 15, 2009 at 6:38 PM

The "if" condition is true and I can even see the code going into following statements while debugging:

      args.CancelProcessing = true;
      HttpContext.Current.Response.StatusCode = 550;

But somehow the httpStatus isn't being set to 550 at the server... And as a result it doesn't go into "if(httpStatus == 550)" in FileStateChanged

Infact when I alterted the httpStatus in FileStateChanged it gives me 200...

May be the page is already rendered and so it cannot set the httpStatus...

Seems really odd but its failing somewhere...

Aug 16, 2009 at 11:12 PM

I have the same problem. It really seems that the statusCode doesn´t change. I hope that the coordinator could help with this issue.

Coordinator
Aug 17, 2009 at 5:05 PM
Edited Aug 17, 2009 at 5:06 PM

I guess there was a test code left in the latest flash that generated error on the flash site. I just recompiled the latest code without any changes and it works.

Get the latest dll or use the source code (better)

Demo:

http://www.flajaxian.com/flajaxian.com/tests/ChangeHttpCode.aspx

<%@ Page Language="C#" %>
<%@ Register TagPrefix="fjx" Namespace="com.flajaxian" Assembly="com.flajaxian.FileUploader" %>
<script runat="server">
protected void FileNameDetermining(object sender, FileNameDeterminingEventArgs args)
{
    args.CancelProcessing = true;
    HttpContext.Current.Response.StatusCode = 550; 

}
</script>
<html>
  <head><title>Test</title>
  <script>
  function FileStateChanged(uploader, file, httpStatus, isLast){
    Flajaxian.fileStateChanged(uploader, file, httpStatus, isLast);
    if(httpStatus == 550){
        uploader.cancel();
        alert("You have reached the maximum allowed storage quota");
    }
  }
  </script>
  </head>
  <body>
    <form runat="server">


<fjx:FileUploader ID="FileUploader1" JsFunc_FileStateChanged="FileStateChanged" runat="server">
    <Adapters>
        <fjx:FileSaverAdapter Runat="server" FolderName="UploadFolder" OnFileNameDetermining="FileNameDetermining" />
    </Adapters>
</fjx:FileUploader>

    </form>
  </body>
</html>

 

Aug 17, 2009 at 5:57 PM

Thank you!

In fact I wanted to check if the file exists and if so, return a message to the user to change the file name. I couldn´t do it this way. Any way I´ll try again.

Thnaks again
----- Original Message -----
From: vladb
To: [email removed]
Subject: Re: httpStatus is not being set [FlajaxianFileUpload:57943]
Date: 17 Aug 2009 09:05:36 -0700

From: vladb

I guess there was a test code left in the latest flash that generated error on the flash site. I just recompiled the latest code without any changes and it works. Demo:

http://www.flajaxian.com/flajaxian.com/tests/ChangeHttpCode.aspx

<%@ Page Language="C#" %>
<%@ Register TagPrefix="fjx" Namespace="com.flajaxian" Assembly="com.flajaxian.FileUploader" %>
<script runat="server">
protected void FileNameDetermining(object sender, FileNameDeterminingEventArgs args)
{
    args.CancelProcessing = true;
    HttpContext.Current.Response.StatusCode = 550; 

}
</script>
<html>
  <head><title>Test</title>
  <script>
  function FileStateChanged(uploader, file, httpStatus, isLast){
    Flajaxian.fileStateChanged(uploader, file, httpStatus, isLast);
    if(httpStatus == 550){
        uploader.cancel();
        alert("You have reached the maximum allowed storage quota");
    }
  }
  </script>
  </head>
  <body>
    <form runat="server">


<fjx:FileUploader ID="FileUploader1" JsFunc_FileStateChanged="FileStateChanged" runat="server">
    <Adapters>
        <fjx:FileSaverAdapter Runat="server" FolderName="UploadFolder" OnFileNameDetermining="FileNameDetermining" />
    </Adapters>
</fjx:FileUploader>

    </form>
  </body>
</html>




Ahmed Zayed

--
Be Yourself @ mail.com
Choose From 200+ Email Addresses
Get a Free Account at www.mail.com!