Re: Media View Path - Strange behaviour
This happened a couple more times since I written the original email, it turns out when it cannot find the file, it prints an error with the wrong path. When the file is found, it uses the intended path. On 1 March 2014 19:57, Stephen S wrote: > Doing pr(ROOT) will print D:\Work\DittoCake > > > On 1 March 2014 05:38, Andrew Lechowicz wrote: > >> What is the value of your `ROOT` constant on the windows machine? >> >> >> On Friday, February 28, 2014 7:01:22 AM UTC-5, Stephen S wrote: >>> >>> Hey >>> >>> I've pulled some working code from a repository this morning, which >>> works at the office using OSX, to my windows machine. >>> >>> The media view is having strange and unexpected behaviour, here is the >>> code (expected path and actual path). >>> >>> http://pastie.org/private/qw6twdc7pk4mm9kqega >>> >>> If you read the book (http://book.cakephp.org/2.0/ >>> en/views/media-view.html) it states the path by default should be >>> absolute unless it's relative to the webroot folder. This only happens on >>> my windows installation. >>> >>> Perhaps this is a bug I should report, rather than something I have done >>> wrong? >>> >>> Cheers! >>> >>> -- >>> Kind Regards >>> Stephen Speakman >>> >> -- >> Like Us on FaceBook https://www.facebook.com/CakePHP >> Find us on Twitter http://twitter.com/CakePHP >> >> --- >> You received this message because you are subscribed to the Google Groups >> "CakePHP" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to cake-php+unsubscr...@googlegroups.com. >> To post to this group, send email to cake-php@googlegroups.com. >> Visit this group at http://groups.google.com/group/cake-php. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > > > -- > Kind Regards > Stephen Speakman > -- Kind Regards Stephen Speakman -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Media View Path - Strange behaviour
Doing pr(ROOT) will print D:\Work\DittoCake On 1 March 2014 05:38, Andrew Lechowicz wrote: > What is the value of your `ROOT` constant on the windows machine? > > > On Friday, February 28, 2014 7:01:22 AM UTC-5, Stephen S wrote: >> >> Hey >> >> I've pulled some working code from a repository this morning, which works >> at the office using OSX, to my windows machine. >> >> The media view is having strange and unexpected behaviour, here is the >> code (expected path and actual path). >> >> http://pastie.org/private/qw6twdc7pk4mm9kqega >> >> If you read the book (http://book.cakephp.org/2.0/ >> en/views/media-view.html) it states the path by default should be >> absolute unless it's relative to the webroot folder. This only happens on >> my windows installation. >> >> Perhaps this is a bug I should report, rather than something I have done >> wrong? >> >> Cheers! >> >> -- >> Kind Regards >> Stephen Speakman >> > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php. > For more options, visit https://groups.google.com/groups/opt_out. > -- Kind Regards Stephen Speakman -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Media View Path - Strange behaviour
What is the value of your `ROOT` constant on the windows machine? On Friday, February 28, 2014 7:01:22 AM UTC-5, Stephen S wrote: > > Hey > > I've pulled some working code from a repository this morning, which works > at the office using OSX, to my windows machine. > > The media view is having strange and unexpected behaviour, here is the > code (expected path and actual path). > > http://pastie.org/private/qw6twdc7pk4mm9kqega > > If you read the book (http://book.cakephp.org/2.0/en/views/media-view.html) > it states the path by default should be absolute unless it's relative to > the webroot folder. This only happens on my windows installation. > > Perhaps this is a bug I should report, rather than something I have done > wrong? > > Cheers! > > -- > Kind Regards > Stephen Speakman > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Media view 1.3
I actually already had debug to 2, but on the bright side I figured out what was wrong, the file on the server had a different name, thats why I couldnt be found... On Dec 30, 2:34 pm, Tilen Majerle wrote: > set debug to 2 and you will see what's going wrong :) > -- > Lep pozdrav, Tilen Majerlehttp://majerle.eu > > 2011/12/30 JTiki > > > > > > > > > I've recently been trying to get a media view up and running, but for > > some reason I keep getting this Error "Error: The requested address '/ > > events/download' was not found on this server." > > My controller code is below > > > function download () { > > $this->view = 'Media'; > > $params = array( > > 'id' => 'SalemFall2011Newsletter.pdf', > > 'name' => 'SalemFall2011Newsletter', > > 'download' => true, > > 'extension' => 'pdf', // must be lower case > > 'path' => APP . 'webroot' . DS . 'files' . DS // don't > > forget terminal 'DS' > > ); > > $this->set($params); > > } > > > Any ideas? > > > -- > > Our newest site for the community: CakePHP Video Tutorials > >http://tv.cakephp.org > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > > cake-php+unsubscr...@googlegroups.com For more options, visit this group > > athttp://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Media view 1.3
set debug to 2 and you will see what's going wrong :) -- Lep pozdrav, Tilen Majerle http://majerle.eu 2011/12/30 JTiki > I've recently been trying to get a media view up and running, but for > some reason I keep getting this Error "Error: The requested address '/ > events/download' was not found on this server." > My controller code is below > > function download () { >$this->view = 'Media'; >$params = array( > 'id' => 'SalemFall2011Newsletter.pdf', > 'name' => 'SalemFall2011Newsletter', > 'download' => true, > 'extension' => 'pdf', // must be lower case > 'path' => APP . 'webroot' . DS . 'files' . DS // don't > forget terminal 'DS' > ); > $this->set($params); >} > > Any ideas? > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Media View: specifying the filename when download => false
yes - last week after upgrading to 2.0 I had the same problem. I wanted to render files as pdf automatically (/controller/action/ [ID].pdf) and it always returned the ID no matter what I did. after some research I found out that this is a well known bug in almost all browsers they simply ignore the "inline filename" header thats probably why cakephp doesnt even bother setting it^^ see my post from last week about this topic: http://www.dereuromark.de/2011/11/21/serving-views-as-files-in-cake2/ Its not the media view but I think it should work in your case, as well, if you make sure that all files are served as "/controller/action/ID/this-is-the-actual- filename.pdf" yours mark On 26 Nov., 22:37, shantamg wrote: > Hi, > > I have noticed that with media view, the file name specified is only > used when download is set to true. I'd like to have the file play in > the browser by default but if they decide to download the link it > should have the name I specified. Anyone know of a fix? > > Thanks, > Jason -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: media view
On Tue, Feb 22, 2011 at 8:55 AM, a17s wrote: > Hello, > I am trying to use the MediaView class to set a download of pdf file. > So far my attempts are not working and I can't seem to find any fault > in my code copied from the book.cakephp.org website. Any help or > thoughts will be appreciated. Define "not working" please. > Find sample code below: > > > $this->view = 'Media'; //set to media download > $params = array( > 'id' => 'catalogue.pdf', > 'name' => 'new_catalogue', > 'download'=>true, > 'extension' => 'pdf', > 'path' => $this->webroot . 'files' . DS ); > $this->set($params); What is $this->webroot? Is there a reason you're not using WEB_ROOT? If you're trying to keep this configurable (perhaps it could be APP--a more reasonable use for MediaView, anyway) it might be better to use a more neutral variable name, like $this->_base. In any case, as Sam mentioned, be sure to debug or log the path. Are you seeing a 404? Are you sure it's not a 404 due to some error and debug being set to 0? If unsure, alter the MediaView render() method to do something besides throwing a 404 for a missing file. Or just triple-check the path and that the file you want it really there and accessible. I can't remember why but my code also always includes the MIME type: 'mimeType' => array($result['ItemFile']['type']) Note that it's an array. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: media view
check that you have no errors hidden away (you need debug to be off for media views to work) - this can be a cause of media views not working also check that $this->webroot . 'files' . DS is what you expect and that the pdf is there - S On 22 February 2011 13:55, a17s wrote: > $this->webroot . 'files' . DS -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Media View related Query
On Fri, Feb 4, 2011 at 2:48 PM, newguy wrote: > no its not working, i get the following error: > > Error: The requested address '/users/display/game' was not found on > this server. If debug is set to 0 and there's any kind of non-fatal error, Cake throws a 404. It's possible you have an error somewhere. > Moreover all the file extensions are fixed to be zip and I have files > on my disk under gamefiles folder in app folder. On clicking link > three I want game.zip to be downloaded where as on clicking link 2 > example1.zip should be downloaded. As i said, pass the file name or slug to the action. Don't hard-code things. It's programming basics. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Media View related Query
Please help someone, am stuck On Feb 4, 11:48 am, newguy wrote: > no its not working, i get the following error: > > Error: The requested address '/users/display/game' was not found on > this server. > > Moreover all the file extensions are fixed to be zip and I have files > on my disk under gamefiles folder in app folder. On clicking link > three I want game.zip to be downloaded where as on clicking link 2 > example1.zip should be downloaded. > > My hurdle is that I want to use the above stated download > function(part of media view) to download different files based on the > link clicked by the user and I followed what you suggested in your > first reply to this thread but it seems that due to my limited > knowledge I couldnt get it right, please help me by explaining in a > little more detail. > > Thanks > > On Feb 4, 8:34 am, cricket wrote: > > > > > > > > > On Fri, Feb 4, 2011 at 3:20 AM, newguy wrote: > > > In continuation of the previous post: > > > In my site on page display there are 4 links and user clicks on it to > > > download 4 different files. This is the cpt file for this: > > > > Select the game to download > > > > > > link('Game 1',array('action'=>'download')); ?> > > li> > > > link('Game 2',array('action'=>'download1')); ?> > > li> > > > link('Game 3',array('controller' => > > > 'users','action' => 'download','slug' => Inflector::slug('game'))); ? > > >> > > > Game 4 > > > > > > > This is my Router::connect: > > > Router::connect('/users/ > > > display/:slug',array('controller'=>'users','action'=>'download'),array('slu > > > g'=>'[-0-9a- > > > z]+','pass'=>array('slug'))); > > > This file to be downloaded on clicking link three is game.zip > > > You're getting close. There's no need to call Inflector::slug(), > > though, if you're going to hard-code the file. > > > So, is this not working? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Media View related Query
no its not working, i get the following error: Error: The requested address '/users/display/game' was not found on this server. Moreover all the file extensions are fixed to be zip and I have files on my disk under gamefiles folder in app folder. On clicking link three I want game.zip to be downloaded where as on clicking link 2 example1.zip should be downloaded. My hurdle is that I want to use the above stated download function(part of media view) to download different files based on the link clicked by the user and I followed what you suggested in your first reply to this thread but it seems that due to my limited knowledge I couldnt get it right, please help me by explaining in a little more detail. Thanks On Feb 4, 8:34 am, cricket wrote: > On Fri, Feb 4, 2011 at 3:20 AM, newguy wrote: > > In continuation of the previous post: > > In my site on page display there are 4 links and user clicks on it to > > download 4 different files. This is the cpt file for this: > > > Select the game to download > > > > link('Game 1',array('action'=>'download')); ?> > li> > > link('Game 2',array('action'=>'download1')); ?> > li> > > link('Game 3',array('controller' => > > 'users','action' => 'download','slug' => Inflector::slug('game'))); ? > >> > > Game 4 > > > > > This is my Router::connect: > > Router::connect('/users/ > > display/:slug',array('controller'=>'users','action'=>'download'),array('slu > > g'=>'[-0-9a- > > z]+','pass'=>array('slug'))); > > This file to be downloaded on clicking link three is game.zip > > You're getting close. There's no need to call Inflector::slug(), > though, if you're going to hard-code the file. > > So, is this not working? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Media View related Query
On Fri, Feb 4, 2011 at 3:20 AM, newguy wrote: > In continuation of the previous post: > In my site on page display there are 4 links and user clicks on it to > download 4 different files. This is the cpt file for this: > > Select the game to download > > link('Game 1',array('action'=>'download')); ?> li> > link('Game 2',array('action'=>'download1')); ?> li> > link('Game 3',array('controller' => > 'users','action' => 'download','slug' => Inflector::slug('game'))); ? >> > Game 4 > > > This is my Router::connect: > Router::connect('/users/ > display/:slug',array('controller'=>'users','action'=>'download'),array('slug'=>'[-0-9a- > z]+','pass'=>array('slug'))); > This file to be downloaded on clicking link three is game.zip You're getting close. There's no need to call Inflector::slug(), though, if you're going to hard-code the file. So, is this not working? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Media View related Query
On Fri, Feb 4, 2011 at 2:50 AM, newguy wrote: > Hi I did what was suggested in the above post and now this is my > download function: > > function download ($slug = null) > { > $this->view = 'Media'; > $params = array( > 'id' => 'example.zip, > 'name' => 'example', > 'download' => true, > 'extension' => 'zip', > 'path' => APP . 'gamefiles' . DS); > > $this->set($params); > } > I have three more links on whose click 3 different files should be > downloded using this very download function, how should I make use of > this slug to download different files. Should it be this: ??? > > function download ($slug = null) > { > $this->view = 'Media'; > $params = array( > 'id' => $slug, > 'name' => 'example', > 'download' => true, > 'extension' => 'zip', > 'path' => APP . 'gamefiles' . DS); > > $this->set($params); > } Are all of the files going to be zips? Because you've hard-coded the extension here. Are your downloadable files recorded in the DB? If so, save the extension for each record. Use the $slug to fetch the desired file's data. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Media View related Query
In continuation of the previous post: In my site on page display there are 4 links and user clicks on it to download 4 different files. This is the cpt file for this: Select the game to download link('Game 1',array('action'=>'download')); ?> link('Game 2',array('action'=>'download1')); ?> link('Game 3',array('controller' => 'users','action' => 'download','slug' => Inflector::slug('game'))); ? > Game 4 This is my Router::connect: Router::connect('/users/ display/:slug',array('controller'=>'users','action'=>'download'),array('slug'=>'[-0-9a- z]+','pass'=>array('slug'))); This file to be downloaded on clicking link three is game.zip Please help me get this link working , thanks On Feb 3, 11:50 pm, newguy wrote: > Hi I did what was suggested in the above post and now this is my > download function: > > function download ($slug = null) > { > $this->view = 'Media'; > $params = array( > 'id' => 'example.zip, > 'name' => 'example', > 'download' => true, > 'extension' => 'zip', > 'path' => APP . 'gamefiles' . DS); > > $this->set($params); > } > I have three more links on whose click 3 different files should be > downloded using this very download function, how should I make use of > this slug to download different files. Should it be this: ??? > > function download ($slug = null) > { > $this->view = 'Media'; > $params = array( > 'id' => $slug, > 'name' => 'example', > 'download' => true, > 'extension' => 'zip', > 'path' => APP . 'gamefiles' . DS); > > $this->set($params); > } > > On Feb 1, 7:13 pm, cricket wrote: > > > > > > > > > On Tue, Feb 1, 2011 at 9:57 PM, newguy wrote: > > > Hi > > > I want to download four different files through 4 different links, I > > > am using Media View to download file but I have to hardcode the file > > > name in the download function in controller: > > > > function download () { > > > $this->view = 'Media'; > > > $params = array( > > > 'id' => 'example.zip', > > > 'name' => 'example', > > > 'download' => true, > > > 'extension' => 'zip', > > > 'path' => APP . 'files' . DS > > > ); > > > $this->set($params); > > > } > > > > This works fine for one file, now for link number 2,3,4 do I need to > > > create 3 different actions and give different file names in them or is > > > there a way in which I can use download() only and depending on which > > > link has been clicked respective file is downloaded. > > > Just pass the file name or slug in the link. I use the latter, where > > each downloadable file has a title and slug: > > > Router::connect( > > '/downloads/:slug', > > array( > > 'controller' => 'files', > > 'action' => 'download' > > ), > > array( > > 'slug' => '[-0-9a-z]+', > > 'pass' => array('slug') > > ) > > ); > > > public function download($slug = null) { ... } > > > Or you could pass the record ID: > > > Router::connect( > > '/downloads/:id', > > array( > > 'controller' => 'files', > > 'action' => 'download' > > ), > > array( > > 'id' => '[0-9]+', > > 'pass' => array('id') > > ) > > ); > > > public function download($id = null) { ... } -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Media View related Query
Hi I did what was suggested in the above post and now this is my download function: function download ($slug = null) { $this->view = 'Media'; $params = array( 'id' => 'example.zip, 'name' => 'example', 'download' => true, 'extension' => 'zip', 'path' => APP . 'gamefiles' . DS); $this->set($params); } I have three more links on whose click 3 different files should be downloded using this very download function, how should I make use of this slug to download different files. Should it be this: ??? function download ($slug = null) { $this->view = 'Media'; $params = array( 'id' => $slug, 'name' => 'example', 'download' => true, 'extension' => 'zip', 'path' => APP . 'gamefiles' . DS); $this->set($params); } On Feb 1, 7:13 pm, cricket wrote: > On Tue, Feb 1, 2011 at 9:57 PM, newguy wrote: > > Hi > > I want to download four different files through 4 different links, I > > am using Media View to download file but I have to hardcode the file > > name in the download function in controller: > > > function download () { > > $this->view = 'Media'; > > $params = array( > > 'id' => 'example.zip', > > 'name' => 'example', > > 'download' => true, > > 'extension' => 'zip', > > 'path' => APP . 'files' . DS > > ); > > $this->set($params); > > } > > > This works fine for one file, now for link number 2,3,4 do I need to > > create 3 different actions and give different file names in them or is > > there a way in which I can use download() only and depending on which > > link has been clicked respective file is downloaded. > > Just pass the file name or slug in the link. I use the latter, where > each downloadable file has a title and slug: > > Router::connect( > '/downloads/:slug', > array( > 'controller' => 'files', > 'action' => 'download' > ), > array( > 'slug' => '[-0-9a-z]+', > 'pass' => array('slug') > ) > ); > > public function download($slug = null) { ... } > > Or you could pass the record ID: > > Router::connect( > '/downloads/:id', > array( > 'controller' => 'files', > 'action' => 'download' > ), > array( > 'id' => '[0-9]+', > 'pass' => array('id') > ) > ); > > public function download($id = null) { ... } -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Media View related Query
On Tue, Feb 1, 2011 at 9:57 PM, newguy wrote: > Hi > I want to download four different files through 4 different links, I > am using Media View to download file but I have to hardcode the file > name in the download function in controller: > > function download () { > $this->view = 'Media'; > $params = array( > 'id' => 'example.zip', > 'name' => 'example', > 'download' => true, > 'extension' => 'zip', > 'path' => APP . 'files' . DS > ); > $this->set($params); > } > > This works fine for one file, now for link number 2,3,4 do I need to > create 3 different actions and give different file names in them or is > there a way in which I can use download() only and depending on which > link has been clicked respective file is downloaded. Just pass the file name or slug in the link. I use the latter, where each downloadable file has a title and slug: Router::connect( '/downloads/:slug', array( 'controller' => 'files', 'action' => 'download' ), array( 'slug' => '[-0-9a-z]+', 'pass' => array('slug') ) ); public function download($slug = null) { ... } Or you could pass the record ID: Router::connect( '/downloads/:id', array( 'controller' => 'files', 'action' => 'download' ), array( 'id' => '[0-9]+', 'pass' => array('id') ) ); public function download($id = null) { ... } -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Media View: Dowload works on local machine from external server, but production server gets 0 byte files...
the path usually doesnt start with http:// its a file path - at least afaik windows: c:/... linux /var/www/... but the constansts should be just about fine: ROOT.DS.'files'.DS.'whatever' thats why you need the media view in the first place because usually you want to serve files that are below the webroot folder (and need to be passed through in order to get accessable) On 15 Nov., 16:42, DigitalDude wrote: > Hey, > > I ran into a strange problem today and need help... > > I added cake's media view as download action to my app, which works > fine when I download files from my virtual hosts on my dev laptop. The > files are being downloaded from a central fileserver, and all files > are downloaded complete and working from there. > > The interesting part is when I try to download the files via my > production server where the app is running, I get 0 byte files! How > can this be? > The folder and files can be accessed by the webserver (I also tried > 777 on the files...) and as I said everything works fine from my local > dev machine. > > Here's the code by the way: > > function download($filename = null) { > $file = $this->Upload->findByFilename($filename); > if(empty($file)) { > $this->Session->setFlash(__('Sorry, could not find > requested file!', true), 'default', array('class' => 'negative')); > $this->redirect($this->referer()); > } > $this->view = 'media'; > $params = array( > 'id' => $file['Upload']['filename'], > 'name' => $file['Upload']['original_name'], > 'download' => true, > 'extension' => 'pdf', > 'path' => 'http://my.fileserver.com/pdf/' > ); > $this->set($params); > > } > > Could this be an apache problem or something with the mimetype? I just > do not understand why I can download the files from my local computer > when the app runs under XAMPP, but not from the production server...? > If there is an access restriction, why can I get the files from here > but not from a real server?! > > Please help... > > Regards, > > DD Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Media View / Download: How to count finished downloads?
interesting - did you test this? i doubt this is working with "normal" php functionality there is no way the browser returns whether it is done or not the browser aborts or is cancelled manually which results in the script to be terminated and the termination after a successful download would be indifferent to it. there is no callback whatsoever to use afterwards. thats what i thought anyway. On 4 Jan., 08:19, biesbjerg wrote: > Hey, > > I modified the MediaView to be a Component, and added some stuff - you > can find the component here:http://bin.cakephp.org/view/599576961 > > 1. Add to components array in the controller. > 2. Parameters are the same, only you should use > $this->Download->download($params); instead of $this->set($params); (And no > need to > > set the view to 'media' > 3. the download-method returns true only successful download, false if > interrupted/cancelled > 4. Additional variables are available after a file has been downloaded > (or not): $this->Download->speed (KB/s), $this->Download->time (How > long did it take to send the file), $this->Download->sent (If > interrupted, how much was sent to the user) > > On Jan 3, 6:10 pm, DigitalDude wrote: > > > Hey, > > > in my app I have some type of file uploading, and also downloading. > > I'm using Cake's Media View, so I can send the file to the user after > > authenticating that he/she is allowed to get that file. > > > So I was wondering, is there any chance to COUNT these downloads? All > > I have in my action is a view-like action which sets the params. I > > could then just save a counting value to my databse, but I think > > that's not really the way to go... > > > (basic usage of the media view...) > > > $this->view = 'media'; > > $params = array( > > 'id' => $file['Upload']['hash'], > > 'name' => $file['Upload']['name'], > > 'download' => true, > > 'extension' => $file['Upload']['type'], > > 'path' => APP . '/uploads/'.$modelpath.'/' > > ); > > $this->set($params); > > > Is there any kind of callback or so after a user has successfully > > downloaded a file? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Media View / Download: How to count finished downloads?
Hey, I modified the MediaView to be a Component, and added some stuff - you can find the component here: http://bin.cakephp.org/view/599576961 1. Add to components array in the controller. 2. Parameters are the same, only you should use $this->Download- >download($params); instead of $this->set($params); (And no need to set the view to 'media' 3. the download-method returns true only successful download, false if interrupted/cancelled 4. Additional variables are available after a file has been downloaded (or not): $this->Download->speed (KB/s), $this->Download->time (How long did it take to send the file), $this->Download->sent (If interrupted, how much was sent to the user) On Jan 3, 6:10 pm, DigitalDude wrote: > Hey, > > in my app I have some type of file uploading, and also downloading. > I'm using Cake's Media View, so I can send the file to the user after > authenticating that he/she is allowed to get that file. > > So I was wondering, is there any chance to COUNT these downloads? All > I have in my action is a view-like action which sets the params. I > could then just save a counting value to my databse, but I think > that's not really the way to go... > > (basic usage of the media view...) > > $this->view = 'media'; > $params = array( > 'id' => $file['Upload']['hash'], > 'name' => $file['Upload']['name'], > 'download' => true, > 'extension' => $file['Upload']['type'], > 'path' => APP . '/uploads/'.$modelpath.'/' > ); > $this->set($params); > > Is there any kind of callback or so after a user has successfully > downloaded a file? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Media View / Download: How to count finished downloads?
you can ONLY check if somebody starts to download not if he stops it or finishes it for counting just add the model method call before you pass those vars to the media view $this->Model->touch(); $this->set($params); with touch() being your count method! (in your controller action) On 3 Jan., 18:10, DigitalDude wrote: > Hey, > > in my app I have some type of file uploading, and also downloading. > I'm using Cake's Media View, so I can send the file to the user after > authenticating that he/she is allowed to get that file. > > So I was wondering, is there any chance to COUNT these downloads? All > I have in my action is a view-like action which sets the params. I > could then just save a counting value to my databse, but I think > that's not really the way to go... > > (basic usage of the media view...) > > $this->view = 'media'; > $params = array( > 'id' => $file['Upload']['hash'], > 'name' => $file['Upload']['name'], > 'download' => true, > 'extension' => $file['Upload']['type'], > 'path' => APP . '/uploads/'.$modelpath.'/' > ); > $this->set($params); > > Is there any kind of callback or so after a user has successfully > downloaded a file? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Media View and Caching
Hi together, thank you for the responses. Link-Protection is not the only reason why i use them. I also use Media Views for counting the hits on the images. I changed the application in the way that thumbnails dont get loaded by mediaview and only the high-res pictures (which should get counted and protected) are done by it. Thank you! bye Tom On 10 Jun., 18:04, brian wrote: > On Wed, Jun 10, 2009 at 10:56 AM, Matt Curry wrote: > > > I don't think caching will help you here, since the image is a static > > file. The big difference is that in the case where you just link to > > the image your web server can return it directly. When you go through > > the MediaView your webserver needs to use PHP which will always be > > slower, regardless of the framework. > > > If you're just trying to prevent link stealing you should look into > > handling this directly with your web server. > > Just to add to Matt''s comment: look into using mod_rewrite to prevent > hotlinking. Using MediaView for this is overkill. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Media View and Caching
On Wed, Jun 10, 2009 at 10:56 AM, Matt Curry wrote: > > I don't think caching will help you here, since the image is a static > file. The big difference is that in the case where you just link to > the image your web server can return it directly. When you go through > the MediaView your webserver needs to use PHP which will always be > slower, regardless of the framework. > > If you're just trying to prevent link stealing you should look into > handling this directly with your web server. > Just to add to Matt''s comment: look into using mod_rewrite to prevent hotlinking. Using MediaView for this is overkill. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Media View and Caching
I don't think caching will help you here, since the image is a static file. The big difference is that in the case where you just link to the image your web server can return it directly. When you go through the MediaView your webserver needs to use PHP which will always be slower, regardless of the framework. If you're just trying to prevent link stealing you should look into handling this directly with your web server. -Matt http://www.pseudocoder.com On Jun 10, 7:51 am, Galdan wrote: > Hi together, > > in my application i've a image gallery. And i show the images by a > media view (against link stealing). > > But all the time the images gets parsed completly by the media view. > > So i wan't to cache the output for a long time (1 month or something). > > But the usual cache functions seems not to work with media views. > > For example, a page with 100 pictures takes about 30 seconds to get > loaded when i use media views, and it takes only 3 seconds if i put > them directly in the page by "image" tags. > > Does anybody know some hints? > > Thank you in advance > bye > Tom --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: media view and files on the fly
Sorry, forgot to mention: you also need to tell it to use that view renderer. In your action: $this->view = 'AppMedia'; Although the way you have it works too, the only thing you lose is the ability to access the original MediaView, which isn't a big deal since this one does all the same things. -Matt http://www.pseudocoder.com On Mar 31, 5:15 pm, "Mark (Germany)" wrote: > are you sure it is app_media.php then? > i only got it to work by leaving it the same name "media.php" in /app/ > views/ > > mark > > On 31 Mrz., 21:45, "Mark (Germany)" > wrote: > > > nice :) > > thx > > > On 31 Mrz., 15:17, Matt Curry wrote: > > > > I had to do this with pdf/xls files returned by a webservice. I took > > > the default media view (/cake/libs/views/media.php) and copied it to / > > > app/views/app_media.php. > > > > Then I modified it so that it checked for a $content view var and > > > wrote that to a tmpfile. > > > Here's the diff:http://bin.cakephp.org/view/1310700342 > > > > -Matthttp://www.pseudocoder.com > > > > On Mar 30, 1:05 pm, "Mark (Germany)" > > > wrote: > > > > > i tried to use the media view for files generated on thefly(some > > > > exported text inside a export.txt or whatever) > > > > but it seems like the media view can only handle downloads of > > > > "existing" files on the server > > > > > trying to rewrite it did not turn out very well > > > > so, did anyone manage to create a txt file to download, that is filled > > > > with the echoed content > > > > > echo 'blabla' > > > > or > > > > $content = 'blabla' transfered to the media view > > > > > without creating locale (temp.) files on the server? > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: media view and files on the fly
are you sure it is app_media.php then? i only got it to work by leaving it the same name "media.php" in /app/ views/ mark On 31 Mrz., 21:45, "Mark (Germany)" wrote: > nice :) > thx > > On 31 Mrz., 15:17, Matt Curry wrote: > > > I had to do this with pdf/xls files returned by a webservice. I took > > the default media view (/cake/libs/views/media.php) and copied it to / > > app/views/app_media.php. > > > Then I modified it so that it checked for a $content view var and > > wrote that to a tmpfile. > > Here's the diff:http://bin.cakephp.org/view/1310700342 > > > -Matthttp://www.pseudocoder.com > > > On Mar 30, 1:05 pm, "Mark (Germany)" > > wrote: > > > > i tried to use the media view for files generated on thefly(some > > > exported text inside a export.txt or whatever) > > > but it seems like the media view can only handle downloads of > > > "existing" files on the server > > > > trying to rewrite it did not turn out very well > > > so, did anyone manage to create a txt file to download, that is filled > > > with the echoed content > > > > echo 'blabla' > > > or > > > $content = 'blabla' transfered to the media view > > > > without creating locale (temp.) files on the server? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: media view and files on the fly
nice :) thx On 31 Mrz., 15:17, Matt Curry wrote: > I had to do this with pdf/xls files returned by a webservice. I took > the default media view (/cake/libs/views/media.php) and copied it to / > app/views/app_media.php. > > Then I modified it so that it checked for a $content view var and > wrote that to a tmpfile. > Here's the diff:http://bin.cakephp.org/view/1310700342 > > -Matthttp://www.pseudocoder.com > > On Mar 30, 1:05 pm, "Mark (Germany)" > wrote: > > > i tried to use the media view for files generated on the fly (some > > exported text inside a export.txt or whatever) > > but it seems like the media view can only handle downloads of > > "existing" files on the server > > > trying to rewrite it did not turn out very well > > so, did anyone manage to create a txt file to download, that is filled > > with the echoed content > > > echo 'blabla' > > or > > $content = 'blabla' transfered to the media view > > > without creating locale (temp.) files on the server? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: media view and files on the fly
I had to do this with pdf/xls files returned by a webservice. I took the default media view (/cake/libs/views/media.php) and copied it to / app/views/app_media.php. Then I modified it so that it checked for a $content view var and wrote that to a tmpfile. Here's the diff: http://bin.cakephp.org/view/1310700342 -Matt http://www.pseudocoder.com On Mar 30, 1:05 pm, "Mark (Germany)" wrote: > i tried to use the media view for files generated on the fly (some > exported text inside a export.txt or whatever) > but it seems like the media view can only handle downloads of > "existing" files on the server > > trying to rewrite it did not turn out very well > so, did anyone manage to create a txt file to download, that is filled > with the echoed content > > echo 'blabla' > or > $content = 'blabla' transfered to the media view > > without creating locale (temp.) files on the server? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: media view and files on the fly
I have so far lest MediaView alone and gone a different way for "fake", dynamic, files. I have made use of parseExtensions to output files. The examples mostly show rss feeds but you can just as easily use it to generate an Excel sheet full of statistics about something on your site or any other dynamic output. /Martin On Mar 30, 7:05 pm, "Mark (Germany)" wrote: > i tried to use the media view for files generated on the fly (some > exported text inside a export.txt or whatever) > but it seems like the media view can only handle downloads of > "existing" files on the server > > trying to rewrite it did not turn out very well > so, did anyone manage to create a txt file to download, that is filled > with the echoed content > > echo 'blabla' > or > $content = 'blabla' transfered to the media view > > without creating locale (temp.) files on the server? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Media View not downloading unless I set headers
Okay, after a short distraction regarding pagination, I went in and checked both the Cake and Apache logs. The Cake error.log shows no errors. (\app\tmp\logs) There were also no errors in the apache\logs\error.log so I checked out the access.log. The response was... 127.0.0.1 - - [01/Mar/2009:17:14:07 +0100] "GET /books/view/1 HTTP/ 1.1" 200 13472 127.0.0.1 - - [01/Mar/2009:17:14:09 +0100] "GET /books/download/ test.epub HTTP/1.1" 200 3104 The Apache Docs say, regarding the "200", that; "This is the status code that the server sends back to the client. This information is very valuable, because it reveals whether the request resulted in a successful response (codes beginning in 2), a redirection (codes beginning in 3), an error caused by the client (codes beginning in 4), or an error in the server (codes beginning in 5). The full list of possible status codes can be found in the HTTP specification (RFC2616 section 10)." Does this mean that $this->set($params); in the "Media View" is not forcing the download? Any ideas on where I am going wrong on this? On Feb 26, 3:04 am, brian wrote: > Have you checked your error log? A white screen typically means a fatal error. > > On Wed, Feb 25, 2009 at 5:49 PM, Mike Cook wrote: > > > I am unable to get the Media View to force the download to start, no > > error is given other than it just lands on a blank page. Here's the > > download function in my controller; > > > function download ($id = null) { > > list($file_name, $file_ext) = split('[.]', $id); > > $this->view = 'Media'; > > $params = array( > > 'id' => $file_name . '.' . $file_ext, > > 'name' => $file_name, > > 'download' => true, > > 'extension' => 'epub', > > 'path' => 'app' . DS . 'files' . DS, > > 'mimeType', array('epub' => 'application/epub+zip' > > )); > > $this->set($params); > > } > > > Like I say, no download (I tried with an without the 'app'.DS on the > > path) but if I send the headers like in this post then it works; > > >http://groups.google.com/group/cake-php/browse_thread/thread/cf567fbb... > > > So, I replace $this->set($params) with; > > > if(!empty($id)){ > > $file = $params['path'] . $params['id']; > > $data = file_get_contents($file); > > $size = filesize($file); > > if( isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER > > ['HTTP_USER_AGENT'], 'MSIE') ) { > > header('Content-Type:application/force-download'); > > } else { > > header('Content-Type:application/epub+zip'); > > header('Content-Length:' . $size); > > header('Content-disposition:attachment;filename="' . $params > > ['id'] . '"'); > > echo $data; > > } > > } else { > > $this->redirect(); > > exit(); > > } > > > I guess that Media View was implemented so we don't have to send the > > headers ourselves - or am I am wrong? > > > Does anyone have any ideas why the default Model View method is not > > working? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Media View not downloading unless I set headers
Have you checked your error log? A white screen typically means a fatal error. On Wed, Feb 25, 2009 at 5:49 PM, Mike Cook wrote: > > I am unable to get the Media View to force the download to start, no > error is given other than it just lands on a blank page. Here's the > download function in my controller; > > function download ($id = null) { > list($file_name, $file_ext) = split('[.]', $id); > $this->view = 'Media'; > $params = array( > 'id' => $file_name . '.' . $file_ext, > 'name' => $file_name, > 'download' => true, > 'extension' => 'epub', > 'path' => 'app' . DS . 'files' . DS, > 'mimeType', array('epub' => 'application/epub+zip' > )); > $this->set($params); > } > > Like I say, no download (I tried with an without the 'app'.DS on the > path) but if I send the headers like in this post then it works; > > http://groups.google.com/group/cake-php/browse_thread/thread/cf567fbb9beccfcb/b69133b6c7d70fa6?hl=en&lnk=gst&q=how+to+have+file+downloads#b69133b6c7d70fa6 > > So, I replace $this->set($params) with; > > if(!empty($id)){ > $file = $params['path'] . $params['id']; > $data = file_get_contents($file); > $size = filesize($file); > if( isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER > ['HTTP_USER_AGENT'], 'MSIE') ) { > header('Content-Type:application/force-download'); > } else { > header('Content-Type:application/epub+zip'); > header('Content-Length:' . $size); > header('Content-disposition:attachment;filename="' . $params > ['id'] . '"'); > echo $data; > } > } else { > $this->redirect(); > exit(); > } > > I guess that Media View was implemented so we don't have to send the > headers ourselves - or am I am wrong? > > Does anyone have any ideas why the default Model View method is not > working? > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Media view not working
Ah nvm, it seemed I had the filename misspelt. Stupid me. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Media View - Acceptable Mime Types
Hi, looking at the source code of media.php. I guess you can define additional mimetypes in controller action which uses media view. Just define your mime types array and set it to the view using $this->set ('mimeType', $myAdditionalMimeTypes); . These will be merged in render function with the default ones defined in media.php. Hope that helps. On 24. Nov 2008, 16:50 h., sotin wrote: > Using cake version 1.2.0.7692 RC3 it does not appear that the > MediaView class pays any attention to the apache mime types (nor > should it since this would be web server specific). Acceptable mime > types in cake are hard coded in cake/libs/view/media.php. Even with > the .xlsx extension defined (using AddType) in Apache the cakemedia > view will not allow downloads of this file extention until the > extension is added into the $mimeType array in themedia.php file. > > Is there another way to add mime types aside from extending this > class? Maybe this could become a feature request ticket? > > Thanks! > > On Nov 24, 10:43 am, sotin wrote: > > > Posted as a reply athttp://book.cakephp.org/view/489/Media-Views > > > 2 - Acceptable MIME types are declared in web server > > > For Apache the acceptable MIME types are given in [apache root]\conf > > \mime.types or alternatively you can specify in [apache root]\conf > > \httd.conf with AddType directive; e.g. > > > AddType application/vnd.openxmlformats xlsx > > > On Nov 24, 9:55 am, sotin wrote: > > > > I originally posted this question in the CakePHP documentation but > > > have moved it here for further discussion > > > > 1 - Modify acceptable mime types? > > > > What is the best way to add an mime type to the 'acceptable' mime > > > types list? I haven't been able to find anything aside from editing > > > cake\libs\view\media.php, which I do not want to do for obvious > > > reasons. Extending the MediaView class also seems a little excessive > > > just to add one mime type. > > > > I am trying to add xlsx download support (application/ > > > vnd.openxmlformats) > > > > Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Media View - Acceptable Mime Types
Here's a bit of shameless self-promotion: http://dsi.vozibrale.com/articles/view/mediaview-is-a-bleeding-bastard http://dsi.vozibrale.com/articles/view/downloadview-a-mediaview-replacement-for-cakephp Hope that helps! On Nov 24, 3:55 pm, sotin <[EMAIL PROTECTED]> wrote: > I originally posted this question in the CakePHP documentation but > have moved it here for further discussion > > 1 - Modify acceptable mime types? > > What is the best way to add an mime type to the 'acceptable' mime > types list? I haven't been able to find anything aside from editing > cake\libs\view\media.php, which I do not want to do for obvious > reasons. Extending the MediaView class also seems a little excessive > just to add one mime type. > > I am trying to add xlsx download support (application/ > vnd.openxmlformats) > > Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Media View - Acceptable Mime Types
Using cake version 1.2.0.7692 RC3 it does not appear that the MediaView class pays any attention to the apache mime types (nor should it since this would be web server specific). Acceptable mime types in cake are hard coded in cake/libs/view/media.php. Even with the .xlsx extension defined (using AddType) in Apache the cake media view will not allow downloads of this file extention until the extension is added into the $mimeType array in the media.php file. Is there another way to add mime types aside from extending this class? Maybe this could become a feature request ticket? Thanks! On Nov 24, 10:43 am, sotin <[EMAIL PROTECTED]> wrote: > Posted as a reply athttp://book.cakephp.org/view/489/Media-Views > > 2 - Acceptable MIME types are declared in web server > > For Apache the acceptable MIME types are given in [apache root]\conf > \mime.types or alternatively you can specify in [apache root]\conf > \httd.conf with AddType directive; e.g. > > AddType application/vnd.openxmlformats xlsx > > On Nov 24, 9:55 am, sotin <[EMAIL PROTECTED]> wrote: > > > I originally posted this question in the CakePHP documentation but > > have moved it here for further discussion > > > 1 - Modify acceptable mime types? > > > What is the best way to add an mime type to the 'acceptable' mime > > types list? I haven't been able to find anything aside from editing > > cake\libs\view\media.php, which I do not want to do for obvious > > reasons. Extending the MediaView class also seems a little excessive > > just to add one mime type. > > > I am trying to add xlsx download support (application/ > > vnd.openxmlformats) > > > Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Media View - Acceptable Mime Types
Posted as a reply at http://book.cakephp.org/view/489/Media-Views 2 - Acceptable MIME types are declared in web server For Apache the acceptable MIME types are given in [apache root]\conf \mime.types or alternatively you can specify in [apache root]\conf \httd.conf with AddType directive; e.g. AddType application/vnd.openxmlformats xlsx On Nov 24, 9:55 am, sotin <[EMAIL PROTECTED]> wrote: > I originally posted this question in the CakePHP documentation but > have moved it here for further discussion > > 1 - Modify acceptable mime types? > > What is the best way to add an mime type to the 'acceptable' mime > types list? I haven't been able to find anything aside from editing > cake\libs\view\media.php, which I do not want to do for obvious > reasons. Extending the MediaView class also seems a little excessive > just to add one mime type. > > I am trying to add xlsx download support (application/ > vnd.openxmlformats) > > Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: media view with files on different server
He's asking how to define the path to the file as absolute rather then relative to the app folder. Which you can't because the MediaView.php file is hard coded to compute the path as follows. $path = APP . $path . $id; There are two ways to resolve this problem. 1) Change the MediaView.php file as you see fit. 2) Create link in your app folder to the other mounted server. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: media view with files on different server
When you say "different server" do you mean one that is on a different domain/website? If so, you can just redirect to that file and not use the media view at all. The media view is used to read local files. Cheers, Adam On Nov 5, 6:15 pm, JuergenRiemer <[EMAIL PROTECTED]> wrote: > Hi bakers, > > I want to use the media view component to manage downloads of files > that reside on a different server > > function download() { > $this->view = 'Media'; > $params = array( > 'id' => 'afile.pdf', > 'name' => 'afile', > 'download' => true, > 'extension' => 'pdf', > 'path' => '\\host\disk_d\files\' > ); > $this->set($params); > > } > > is relative to APP as put in media.php line 111. Do I have to > modify the file ( take out the APP constant ) to make that work? Is > there a more elegant way? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---