Welcome Guest, Not a member yet? Register   Sign In
SWFUpload and CSRF Protection
#1

[eluser]Unknown[/eluser]
I am experiencing a strange issue when using SWFUpload while CSRF protection is on. I am getting a 500 error every time I upload a file. I added post_params to SWFUpload like this:

Code:
post_params: { "csrf_token_name" : $.cookie("csrf_cookie_name") }


But this doesn't seem to work (still getting 500 responses from the server). To test it more granularly, I ran the following snippet:

Code:
$.ajax({
  type: 'POST',
  url: "http://www.localdev.com/image",
  data: { 'csrf_token_name' : $.cookie('csrf_cookie_name') },
  success: function( result ){ alert( result ); },
  dataType: "text"
});

and THAT comes back just fine. So, does anyone know why the response would be different for a request coming from jQuery and one coming from a SWF? I logged the results and see that the post_params are indeed getting passed to the $_POST array.

Any help would be greatly appreciated. I'm sure I'm overlooking something obvious.

Thanks.

EBN




Theme © iAndrew 2016 - Forum software by © MyBB