Controller method/action being called twice (once POST and once GET) for file upload - why?

I'm uploading a file via the user's browser. The index method in my controller is:

  <%= form_tag({:action=>'receive_file'}, :multipart => true)%>      <input type="file" name="user_data_file" />      <p></p>      <input type="submit" value="Upload" />   </form>

I get a form with a 'browse' button and an 'upload' button. I use the browse control to select a file and I press the 'upload' button.

The method 'receive_file' in my controller gets called (with method GET) and executes, then passes control to the corresponding view so far so good.

The strange thing is that behind the scenes, something immediately calls my 'receive_file' method a second time (this time with method POST).

Why is this hapenning? How am I supposed to handle it? I don't want to execute my receive_file method twice.

Thanks for your help, Yoram

per the subject line, further investigation reveals that all the methods in my controller that i am using, are called exactly twice each time i expect them to be called once. i am confused...

per the subject line, further investigation reveals that all the methods in my controller that i am using, are called exactly twice each time i expect them to be called once. i am confused...

Anything interesting in your controller? Can you see (using tcpdump or whatever your platform has) whether the browser is actually making two requests ?

Fred

Fred, thanks:

Well - per your suggestion, I turned net tracking on in firebug (I'm using firefox). And the problem went away... like Heisenberg said :-).

Sorry for bothering the list with such artifact.

It's a little scary to see the browser get in to such a state though...

Y