• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CI Controller run/executes twice (using SWFUpload)

[eluser]Peng Kong[/eluser]
Does your controller run twice when you load a page? Are you using SWFUpload?
If your answer to both questions is 'Yes!' Read on.

Ok just one more question lol. Did you specify "button_image_url"?
If your answer is 'no', that's what causing the problem!

When using the SWFUpload library with Codeigniter you MUST always specify button_image_url.
If you're don't need a button image try using a transparent 1px by 1px gif.

Quote:var swfu = new SWFUpload({
// Button settings
button_placeholder_id: "btnPhotoUpload",
button_image_url: "images/blank.gif",

Loading an external resource (img, js, etc) that isn't there (invalid url) causes our beloved CI to execute the controller again. The swfupload.swf always does a GET request to the 'button_image_url' and if you didn't specify it 404 occurs causing CI to re-run it's controller.

Hope this helps someone Smile

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.