0

I am currently working on my capstone project for my software engineering class. We are creating a website so game design students at my university can upload games they've made essentially creating a 'showcase' for the Game Design department.

Unfortunately, many games created in flash have dependencies they need to load. Since the files are uploaded using plupload to /uploads/flash and everything is browsed through index.php, when a dependency for an embed is needed it isn't loaded (and usually the flash game just stops)

Has anyone encountered this issue before? What steps should be taken to remedy or 'bypass' this issue? obviously uploading all files to the root directory isn't a very good option.

Thanks!

EDIT: I would also like to note that I have tried adding the following to the embed, but to no avail.

     <param name="base" value="<?php echo base_url("uploads/flash/"); ?>/">
  • 1
    What's your `.htaccess` file look like? Are you using pretty URLs (not `index.php?~`)? – Seabass May 08 '12 at 19:34
  • Hi zenbait, Im actually (currently) running on cherokee server, so I have my rewrite set up through that. I do have a htaccess file that should work once the code is migrated to university servers. http://pastebin.com/UeLkGaMV – Karl Jakober May 08 '12 at 19:38
  • I haven't tried Cherokee, but I've found that CI works best on LAMP (WAMP) stacks with `.htaccess` and `mod_rewrite` support. – Seabass May 08 '12 at 19:44
  • im not having any issues with codeigniter itself..... – Karl Jakober May 08 '12 at 19:50
  • `.htaccess` is to CodeIgniter as chicken is to chicken soup (in my experience). Being able to edit how your content is routed **outside** of CI is important. There are alternatives, of course. – Seabass May 08 '12 at 19:55
  • and I have no issues doing that. I'm not sure why you think that is the issue? care to clarify? Cherokee-server simply handles rewriting via the admin panel rather than a .htaccess file and in the long run works more efficiently. there are no differences in its behaviors vs a more traditional htaccess file. – Karl Jakober May 08 '12 at 19:56

2 Answers2

1

What dependencies? images?

You could make an htaccess rule that makes /* redirect to index.php/file/?url=$url

the file controller would just echo the file from /uploads/flash

Edit

<param name='movie' value='<?php echo base_url("uploads/flash/"); ?>player.swf'>
Colin Brock
  • 21,267
  • 9
  • 46
  • 61
Zenonv4
  • 13
  • 4
0

You'll need to edit your .htaccess file to not include any of your asset file types. So it should look something like:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI}  !(\.mp3|\.swf|\.gif|\.jpeg|\.bmp)$
RewriteRule ^(.*)$ index.php?/$1 [L]

This will mean that any request with a .mp3, .swf, .gif, .jpeg or .bmp will never be routed though index.php.

The code above is completely untested, but I think it is the correct approach.

From here: How to redirect all requests to a file, except images using Apache?

Community
  • 1
  • 1
Nick Pyett
  • 3,338
  • 1
  • 23
  • 27
  • Thanks for the reply. Like i mentioned in a comment I am using cherokee server, so I do my rewrites through that (though i do have a htaccess file for later migration). Currently my entire uploads directory is being passed as a static directory properly (not through codeigniter). if it wasn't, i would think no .swf would be displayed at all and I wouldn't even be able to tell if dependencies were being loaded or not. I don't think this is currently the issue – Karl Jakober May 08 '12 at 19:49
  • Ok I'm not familiar with Cherokee. My thinking was that the CI 404 page (which would show if all requests we routed through CI, including for files not found without the above .htaccess mod) was somehow messing with your Flash embeds. Good luck! – Nick Pyett May 09 '12 at 10:23