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 hellospeak...@gmail.com wrote: Doing pr(ROOT) will print D:\Work\DittoCake On 1 March 2014 05:38, Andrew Lechowicz drew.lechow...@gmail.com 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 drew.lechow...@gmail.com 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.
Media View Path - Strange behaviour
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 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: CakePHP Media View Download of PDF Files Size Limit?
Hi Would you mind sharing the code snippet to download pdf files using mediaview in cakephp controller. I am able to download the file and but I try to open the pdf after the download is complete, I get invalid/corrupt file error from Adobe Reader. Other file types work just fine. I wonder if the header needs to be setup in a certain way. I am using Cakephp 1.3 -BC On Monday, March 28, 2011 8:40:14 PM UTC-4, Lawrence wrote: I've setup downloading of PDF files using the media view. It's working great and I can basically force authentication prior to users downloading the files. The one problem I've run into is that once a PDF file goes over a certain size, the file won't download. I'm given the prompt to download the file, the option to specify where I'd like to save the file, but after that the file download doesn't start. I've gone through the logs (cake and apache) and cannot see anything obvious. Again smaller PDF files are being downloaded properly. Would love to hear if anyone else has run into this issue before or whether anyone has any tips on where I can investigate further. Thanks! -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: CakePHP media view not functioning.
Are you using the correct URL? In the example on the link you gave, from your localhost, it would be as follows: localhost/appname/example/download -- 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
CakePHP media view not functioning.
Hi. I'm Nizam. I'm newbie to this CakePHP. I'm now on a project using CakePHP 1.3 .. My problem now is using the media view. It is to enable admin to download the necessary files uploaded by the user. I try to implement media view like stated in here http://book.cakephp.org/1.3/view/1094/Media-Views with a little tweaks but not functioning. I also try the default tutorial and have my example.docx on the location. Yet,still not solve my problem. For both problems,the error stated is Error: The requested address 'the web adress' was not found on this server. What do I do wrong actually?? Please. I've been googling and trying many solution and not happening. I'm behind schedule now. -- 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
Media view 1.3
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
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 jeremyt...@gmail.com 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 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 tilen.maje...@gmail.com wrote: set debug to 2 and you will see what's going wrong :) -- Lep pozdrav, Tilen Majerlehttp://majerle.eu 2011/12/30 JTiki jeremyt...@gmail.com 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
Media View: specifying the filename when download = false
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: 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 jason.galu...@gmail.com 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
CakePHP Media View Download of PDF Files Size Limit?
I've setup downloading of PDF files using the media view. It's working great and I can basically force authentication prior to users downloading the files. The one problem I've run into is that once a PDF file goes over a certain size, the file won't download. I'm given the prompt to download the file, the option to specify where I'd like to save the file, but after that the file download doesn't start. I've gone through the logs (cake and apache) and cannot see anything obvious. Again smaller PDF files are being downloaded properly. Would love to hear if anyone else has run into this issue before or whether anyone has any tips on where I can investigate further. Thanks! -- 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
media view
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. 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); -- 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 godlyfr...@googlemail.com 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
On Tue, Feb 22, 2011 at 8:55 AM, a17s godlyfr...@googlemail.com 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
Still stuck with Media View some one please help!!!
I have a display page with follwoing 4 links: pSelect the game to download/p ul li?php echo $html-link('Game 1',array('action'='download')); ?/ li li?php echo $html-link('Game 2',array('action'='download1')); ?/ li li?php echo $html-link('Game 3',array('action'='download1')); ?/ li liGame 4/li /ul On clicking each link a different file should be downloaded. I am using Media View to dlownload file placed on my disk but since the file name is hardcoded I am able to download only one file through the download fucntion, I want to know that is it possible that I just pass the name of the file to be downloaded(depending on the link clicked) to the download function of media view and the respective file is downloaded(extension of all files is zip). Heres my controller code: function download () { $this-view = 'Media'; $params = array( 'id' = 'example.zip, 'name' = 'example', 'download' = true, 'extension' = 'zip', 'path' = APP . 'gamefiles' . DS); $this-set($params); } Guys am new here so please help me witha little more explanation than usual. Thanks -- 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: Still stuck with Media View some one please help!!!
On Feb 5, 11:16 am, newguy aimanparv...@gmail.com wrote: I have a display page with follwoing 4 links: pSelect the game to download/p ul li?php echo $html-link('Game 1',array('action'='download')); ?/ li li?php echo $html-link('Game 2',array('action'='download1')); ?/ li li?php echo $html-link('Game 3',array('action'='download1')); ?/ li liGame 4/li /ul On clicking each link a different file should be downloaded. I am using Media View to dlownload file placed on my disk but since the file name is hardcoded I am able to download only one file through the download fucntion, I want to know that is it possible that I just pass the name of the file to be downloaded(depending on the link clicked) to the download function of media view and the respective file is downloaded(extension of all files is zip). Heres my controller code: function download () { $this-view = 'Media'; $params = array( 'id' = 'example.zip, 'name' = 'example', 'download' = true, 'extension' = 'zip', 'path' = APP . 'gamefiles' . DS); $this-set($params); } Guys am new here so please help me witha little more explanation than usual. 3 tips 1 don't create duplicate threads - that's really irritating. 2 how is your question any different than you want to view post 1, 2, 3 of the blog tutorial? 3 the media view file is written in php - you can debug it. AD -- 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: Still stuck with Media View some one please help!!!
You need to let your download function know which file to download. You can do this by passing the name of the file into the function: li?php echo $html-link('Game 1',array('action'='download', 'filename1')); ?/li li?php echo $html-link('Game 2',array('action'='download', 'filename2')); ?/li function download ($filename = '') { $this-view = 'Media'; $params = array( 'id' = $filename, 'name' = 'example', 'download' = true, 'extension' = 'zip', 'path' = APP . 'gamefiles' . DS); $this-set($params); } If you don't want to reveal the name of the file, you could store them in a table and pass in the id of the record instead of the filename, then in your download function do a find to get the name first. Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 5 Feb 2011, at 10:16, newguy wrote: I have a display page with follwoing 4 links: pSelect the game to download/p ul li?php echo $html-link('Game 1',array('action'='download')); ?/ li li?php echo $html-link('Game 2',array('action'='download1')); ?/ li li?php echo $html-link('Game 3',array('action'='download1')); ?/ li liGame 4/li /ul On clicking each link a different file should be downloaded. I am using Media View to dlownload file placed on my disk but since the file name is hardcoded I am able to download only one file through the download fucntion, I want to know that is it possible that I just pass the name of the file to be downloaded(depending on the link clicked) to the download function of media view and the respective file is downloaded(extension of all files is zip). Heres my controller code: function download () { $this-view = 'Media'; $params = array( 'id' = 'example.zip, 'name' = 'example', 'download' = true, 'extension' = 'zip', 'path' = APP . 'gamefiles' . DS); $this-set($params); } Guys am new here so please help me witha little more explanation than usual. Thanks -- 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 related Query
On Fri, Feb 4, 2011 at 2:48 PM, newguy aimanparv...@gmail.com 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
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: pSelect the game to download/p ul li?php echo $html-link('Game 1',array('action'='download')); ?/ li li?php echo $html-link('Game 2',array('action'='download1')); ?/ li li?php echo $html-link('Game 3',array('controller' = 'users','action' = 'download','slug' = Inflector::slug('game'))); ? /li liGame 4/li /ul 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 aimanparv...@gmail.com 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 zijn.digi...@gmail.com wrote: On Tue, Feb 1, 2011 at 9:57 PM, newguy aimanparv...@gmail.com 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 Fri, Feb 4, 2011 at 2:50 AM, newguy aimanparv...@gmail.com 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
On Fri, Feb 4, 2011 at 3:20 AM, newguy aimanparv...@gmail.com 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: pSelect the game to download/p ul li?php echo $html-link('Game 1',array('action'='download')); ?/ li li?php echo $html-link('Game 2',array('action'='download1')); ?/ li li?php echo $html-link('Game 3',array('controller' = 'users','action' = 'download','slug' = Inflector::slug('game'))); ? /li liGame 4/li /ul 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
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 zijn.digi...@gmail.com wrote: On Fri, Feb 4, 2011 at 3:20 AM, newguy aimanparv...@gmail.com 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: pSelect the game to download/p ul li?php echo $html-link('Game 1',array('action'='download')); ?/ li li?php echo $html-link('Game 2',array('action'='download1')); ?/ li li?php echo $html-link('Game 3',array('controller' = 'users','action' = 'download','slug' = Inflector::slug('game'))); ? /li liGame 4/li /ul 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
Please help someone, am stuck On Feb 4, 11:48 am, newguy aimanparv...@gmail.com 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 zijn.digi...@gmail.com wrote: On Fri, Feb 4, 2011 at 3:20 AM, newguy aimanparv...@gmail.com 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: pSelect the game to download/p ul li?php echo $html-link('Game 1',array('action'='download')); ?/ li li?php echo $html-link('Game 2',array('action'='download1')); ?/ li li?php echo $html-link('Game 3',array('controller' = 'users','action' = 'download','slug' = Inflector::slug('game'))); ? /li liGame 4/li /ul 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
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 zijn.digi...@gmail.com wrote: On Tue, Feb 1, 2011 at 9:57 PM, newguy aimanparv...@gmail.com 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
Media View related Query
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. Thanks -- 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 aimanparv...@gmail.com 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
Media View: Dowload works on local machine from external server, but production server gets 0 byte files...
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: 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 e.blumsten...@googlemail.com 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
Debug error with media view
I am using the media view to allow customers to download PDF documents they have purchased. Everything is working fine, but the debug.log has these lines in it: 2010-09-28 22:53:24 Notice: Notice (8): ob_end_clean() [a href='ref.outcontrol'ref.outcontrol/a]: failed to delete buffer. No buffer to delete. in [/xxx/cake/libs/view/media.php, line 274] 2010-09-28 22:53:24 Notice: Notice (8): ob_flush() [a href='ref.outcontrol'ref.outcontrol/a]: failed to flush buffer. No buffer to flush. in [/xxx/cake/libs/view/media.php, line 283] (site path changed to xxx above). The second line is repeated ~20 times. Any ideas? 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
Display a view in a iframe using Media View
Hi I'm using Media view to allow my users to download files and to keep files on top the web server root. Now I have the need to display these files inside an iframe of the page. I try to use Media View and set 'download' parameter false but I get an Invalid Content error. I would ask if exists a pattern to keep files on top the web server root but to have the possibility to display them on a iframe? Thanks 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: Display a view in a iframe using Media View
Sorry I have mistake the url in the iframe . All works fine :) . On 5 Mar, 09:50, marco.rizze...@gmail.com marco.rizze...@gmail.com wrote: Hi I'm using Media view to allow my users to download files and to keep files on top the web server root. Now I have the need to display these files inside an iframe of the page. I try to use Media View and set 'download' parameter false but I get an Invalid Content error. I would ask if exists a pattern to keep files on top the web server root but to have the possibility to display them on a iframe? Thanks 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
How to correct: double file-extension when i download something (media view)
Hello, i almost solved my problem, but there is still a little fault. In one of my views i readout a database cell, with a text inside, e.g. 13.pdf (13.pdf = document_name). The little fault is, when i click on the text in the column (e.g. 13.pdf) a download-windows opens and the file i download is called 13.pdf.pdf. :( So what is wrong there? Source-code in my view to invoke the download-method in the controller: {{{ td?php echo $html-link($document['Document']['document_name'], array('action'='download', $document['Document']['id'])); ?/td }}} Source of my download-function in my documents_controller: {{{ function download($id = null) { $this-view = 'Media'; $this-autoLayout = false; $this-Document-recursive = -1; $document = $this-Document-read(null, $id); if (empty($document)) { $this-redirect('/', 404, true); } $file = $document['Document']['document_name']; $basename = basename($file); $file_extension = strtolower(substr(strrchr($basename,.),1)); $this-set('id', $document['Document']['document_name']); $this-set('name', $basename); $this-set('download', true); $this-set('extension', $file_extension); $this-set('path',APP.'files'.DS); } }}} The files are stored in cake - app - files. Thanks if someone can help!!! 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: How to correct: double file-extension when i download something (media view)
The basename function returns the filename with the suffix! Try to change your code to: [code] $basename = basename($file); $file_extension = substr(strrchr($basename,.),1); $basename = basename($file, '.'.$file_extension); ... $this-set('extension', strtolower($file_extension)); [/code] The first basename() usage gets the full filename, including the suffix. The second basename() usage removes the suffix from the filename. Hope this helps you on the way, John On Feb 3, 9:34 am, sebb86 kahlc...@googlemail.com wrote: Hello, i almost solved my problem, but there is still a little fault. In one of my views i readout a database cell, with a text inside, e.g. 13.pdf (13.pdf = document_name). The little fault is, when i click on the text in the column (e.g. 13.pdf) a download-windows opens and the file i download is called 13.pdf.pdf. :( So what is wrong there? Source-code in my view to invoke the download-method in the controller: {{{ td?php echo $html-link($document['Document']['document_name'], array('action'='download', $document['Document']['id'])); ?/td }}} Source of my download-function in my documents_controller: {{{ function download($id = null) { $this-view = 'Media'; $this-autoLayout = false; $this-Document-recursive = -1; $document = $this-Document-read(null, $id); if (empty($document)) { $this-redirect('/', 404, true); } $file = $document['Document']['document_name']; $basename = basename($file); $file_extension = strtolower(substr(strrchr($basename,.),1)); $this-set('id', $document['Document']['document_name']); $this-set('name', $basename); $this-set('download', true); $this-set('extension', $file_extension); $this-set('path',APP.'files'.DS); The files are stored in cake - app - files. Thanks if someone can help!!! 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: How to correct: double file-extension when i download something (media view)
John Hello, thanks for your answer! :) I've added your code. Well, I found out, that my old code (same result with your code) also works, but only with 3 of my 4 test-data-rows. It works for '13.pdf', '288.pdf' and '3.pdf'. It fails for '19.pdf' (result on click = 19.pdf.pdf) and i absolutely dont know why??!??!? That's very confusing. The pdf-fles are all the same, only the filename is changed. 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: How to correct: double file-extension when i download something (media view)
John Hello, thanks for your answer! :) I've added your code. Well, I found out, that my old code (same result with your code) also works, but only with 3 of my 4 test-data-rows. It works for '13.pdf', '288.pdf' and '3.pdf'. It fails for '19.pdf' (result on click = 19.pdf.pdf) and i absolutely dont know why??!??!? That's very confusing. The pdf-fles are all the same, only the filename is changed. Also thanks for your addition with strtolower with the file extension! 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: How to correct: double file-extension when i download something (media view)
John Hello, thanks for your answer! :) I've added your code. Well, I found out, that my old code (same result with your code) also works, but only with 3 of my 4 test-data-rows. It works for '13.pdf', '288.pdf' and '3.pdf'. It fails for '19.pdf' (result on click = 19.pdf.pdf) and i absolutely dont know why??!??!? That's very confusing. The pdf-fles are all the same, only the filename is changed. Also thanks for your addition to use strtolower with the file extension. 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: How to correct: double file-extension when i download something (media view)
I suggest you turn on debug and add some debug statements in between your code, so you can see what the content of each variable is at specific places. Debug is turned on in your core.php file in the config directory. Use debug statements: debug($basename); debug($file_extension); and maybe some more, so you can check the content. Enjoy, John On Feb 4, 9:06 am, sebb86 kahlc...@googlemail.com wrote: John Hello, thanks for your answer! :) I've added your code. Well, I found out, that my old code (same result with your code) also works, but only with 3 of my 4 test-data-rows. It works for '13.pdf', '288.pdf' and '3.pdf'. It fails for '19.pdf' (result on click = 19.pdf.pdf) and i absolutely dont know why??!??!? That's very confusing. The pdf-fles are all the same, only the filename is changed. Also thanks for your addition to use strtolower with the file extension. 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
No download progress using media view
My app delivers jpeg images and zip files through the media view. Even though the content length is specified correctly in the response headers, the browser doesn't use it to display the download progress. These are the request and response headers: GET http://localhost/test/DSC03701.jpg Load Flags[LOAD_DOCUMENT_URI LOAD_INITIAL_DOCUMENT_URI ] Content Size[3342590] Mime Type[image/ jpeg] Date[Fri, 15 Jan 2010 20:44:12 GMT] Server[Apache/2.2.11 (Ubuntu) PHP/5.2.6-3ubuntu4.5 with Suhosin- Patch] X-Powered-By[PHP/5.2.6-3ubuntu4.5] P3P[CP=NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM] Content-Disposition[attachment; filename=DSC03701.JPG.jpg;] Expires[0] Accept-Ranges[bytes] Cache-Control[private] Pragma[private] Content-Length[3342590] Keep-Alive[timeout=15, max=100] Connection[Keep-Alive] Content-Type[application/octet-stream] These are the response headers when downloading the same file directly from a web accessible directory: GET http://localhost/site/pictures/download/350 Load Flags [LOAD_DOCUMENT_URI LOAD_INITIAL_DOCUMENT_URI ] Content Size[3342590] Mime Type[application/octet-stream] Date[Fri, 15 Jan 2010 20:42:04 GMT] Server[Apache/2.2.11 (Ubuntu) PHP/5.2.6-3ubuntu4.5 with Suhosin- Patch] Last-Modified[Fri, 15 Jan 2010 17:20:20 GMT] Etag[207c-3300fe-47d3737d7a190] Accept-Ranges[bytes] Content-Length[3342590] Keep-Alive[timeout=15, max=94] Connection[Keep-Alive] Content-Type[image/jpeg] Tested with FF 3.5.7 and Chrome 4.0.249.43. My media view variables: [name] = abcde [id] = abcde.jpg [extension] = jpg [path] = /home/bram/public_html/site/app/uploads/ [download] = 1 Does anyone have a clue what's going on here? What do browsers expect and how can I tweak the media view parameters to let it download *with* progress indication? B 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 k...@biesbjerg.com 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 e.blumsten...@googlemail.com 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
Media View / Download: How to count finished downloads?
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 e.blumsten...@googlemail.com 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 e.blumsten...@googlemail.com 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
When I use Media View ,my session deleted
i use my custom auth system in my project and it save user informatin into session(no used Auth Component) $this-Session-write( 'Cms.User', array (...) ); when is use This Code function profile_donwload( $paperID ) { if ( $file = $this-Paper-Attachment-read( null, $paperID ) ) { $this-view = 'Media'; $params = array( 'id' = 'paper.'.$file['Attachment']['format'], 'name' = $file['Attachment']['fname'], 'download' = true, 'extension' = $file['Attachment']['format'], 'path' = WWW_ROOT .'data'.DS.$file['Attachment'] ['for'].DS.$file['Attachment']['paper_id'].DS ); $this-set($params); } } after Downloading file or Canceling it ,my session's deleted,why ? 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: caching Media View
Setting the 'cache' option will send the Cache-Control: max- age=time, Expires=converted time and Pragma: cache headers. It does not change the response HTTP 1.1 code to 304, nor does it set the If-Modified-Since header. -j. On Oct 31, 2:17 am, tol daviddevr...@gmail.com wrote: Can someone tell me how caching in media views is supposed to work? example: $this-view = 'Media'; $params = array( 'id' = $id, 'cache' = 10, 'download' = false, 'extension' = 'jpg', 'path' = 'restricted' . DS . 'uservideo' . DS ); $this-set($params); Works fine but I get the feeling its not caching. The headers of the images are 200 OK not 304 Am I doing something wrong? Or am I misunderstanding / overlooking something? 'cache'=true does not change anything either... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
caching Media View
Can someone tell me how caching in media views is supposed to work? example: $this-view = 'Media'; $params = array( 'id' = $id, 'cache' = 10, 'download' = false, 'extension' = 'jpg', 'path' = 'restricted' . DS . 'uservideo' . DS ); $this-set($params); Works fine but I get the feeling its not caching. The headers of the images are 200 OK not 304 Am I doing something wrong? Or am I misunderstanding / overlooking something? 'cache'=true does not change anything either... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Chain media view
Hi, I'm trying to make a chain media view in order to integrate my system with another one. One of the issues I'm having is showing images. Since the system that holds the images is using media view to protect the images I was wondering if it is possible to chain the response from the media view of one system to media view to another. One lazy approach would be to pass the session_id as a GET parameter, but that would not be very nice. In java I would use a chain of streams. Anyone had this problem? Thank in advance. Thiago Nuic Vidigal --~--~-~--~~~---~--~~ 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: Chain media view
Got it working by creating my own Media view based on CakePHP's one. On Tue, Sep 8, 2009 at 11:43 AM, Thiago Nuic Vidigal tvidi...@gmail.comwrote: Hi, I'm trying to make a chain media view in order to integrate my system with another one. One of the issues I'm having is showing images. Since the system that holds the images is using media view to protect the images I was wondering if it is possible to chain the response from the media view of one system to media view to another. One lazy approach would be to pass the session_id as a GET parameter, but that would not be very nice. In java I would use a chain of streams. Anyone had this problem? Thank in advance. Thiago Nuic Vidigal --~--~-~--~~~---~--~~ 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: getting a 404 with Media View
Thanks brian! I finally got around to testing this in our production environment tonight. Sure enough, the path wasn't right. I added APP . to the front of my path and it fixed the problem. Thanks for the advice. It's still odd to me that it works in our test environment fine without it, but not in production. Wonder if there is some sort of configuration in apache that could cause this. Oh well, got it working, thanks again! On Jul 28, 12:32 pm, brian bally.z...@gmail.com wrote: MediaView::render() fires a 404 if ... you guessed it--the file cannot be found. I had some similar trouble a while back (see link below). I placed a die(debug($path)) line just before that check and eventually figured out the problem is that is_dir() can use a relative path and it was throwing things off. I'm sorry that I can't remember the details better than that but I solved the problem by setting path param like so: 'path' = APP.$result['ItemFile']['directory'].DS, Although, if your app is working locally, perhaps the problem is simply that apache doesn't have read permission on that directory. But start with debugging the path to be sure it what you expect. http://groups.google.com/group/cake-php/browse_thread/thread/0f648c14... On Tue, Jul 28, 2009 at 10:37 AM, Stinkbugjustink...@gmail.com wrote: I'm assuming this is an apache config problem, but I'm not sure what could be causing it. Thought I'd just ask the community to see if anyone knew what the problem might be. I'm using the Media view to download files and have the files directory outside the webroot. I'm getting a 404 Page cannot be found error when tring to download the file. It works in out test envirnoment just fine, but when I move into production, I get this error. Could it be an apache config problem, or an app problem? --~--~-~--~~~---~--~~ 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: getting a 404 with Media View
sounds like a permissions problem. who owns that directory? if you are in a shell type chown accountnameHere /htmldirectory/ and check read/execute permissions. also a stray or misconfigured .htaccess can cause these problems. On Jul 28, 10:37 am, Stinkbug justink...@gmail.com wrote: I'm assuming this is an apache config problem, but I'm not sure what could be causing it. Thought I'd just ask the community to see if anyone knew what the problem might be. I'm using the Media view to download files and have the files directory outside the webroot. I'm getting a 404 Page cannot be found error when tring to download the file. It works in out test envirnoment just fine, but when I move into production, I get this error. Could it be an apache config problem, or an app problem? --~--~-~--~~~---~--~~ 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: getting a 404 with Media View
Thanks for the tips guys. I'll have to do these tests late at night since it's on a production box. Since I'm using CakePHP I haven't messed with the .htaccess files. They are what comes with Cake. The permissions on the directory is chmod 777. the owner and groups are root.data, the same as our test box and it works fine there. The files in the directory are wwwrun.www, which is the apache user I guess. My files directory is actually outside of the app directory. I wanted to set it up this way for deployment reasons. So with the debug information on my local windows box, I get something like this: C:\wamp\www\intranet\app\../files\filename.pdf which I thought was a bit odd, but it still works. On our test linux box I got something like this. /srv/www/vhosts/intranet/app/../files/filename.pdf and it works fine. I'm leaning towards some sort of config problem, whether it's permissions or something in apache. It's just odd to me that it would work fine on my local box and the test server, but not on production. I'll check the debug stuff on production tonight probably. --~--~-~--~~~---~--~~ 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: getting a 404 with Media View
well let us know what you come up with it may help someone in the future On Jul 29, 9:49 am, Stinkbug justink...@gmail.com wrote: Thanks for the tips guys. I'll have to do these tests late at night since it's on a production box. Since I'm using CakePHP I haven't messed with the .htaccess files. They are what comes with Cake. The permissions on the directory is chmod 777. the owner and groups are root.data, the same as our test box and it works fine there. The files in the directory are wwwrun.www, which is the apache user I guess. My files directory is actually outside of the app directory. I wanted to set it up this way for deployment reasons. So with the debug information on my local windows box, I get something like this: C:\wamp\www\intranet\app\../files\filename.pdf which I thought was a bit odd, but it still works. On our test linux box I got something like this. /srv/www/vhosts/intranet/app/../files/filename.pdf and it works fine. I'm leaning towards some sort of config problem, whether it's permissions or something in apache. It's just odd to me that it would work fine on my local box and the test server, but not on production. I'll check the debug stuff on production tonight probably. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
getting a 404 with Media View
I'm assuming this is an apache config problem, but I'm not sure what could be causing it. Thought I'd just ask the community to see if anyone knew what the problem might be. I'm using the Media view to download files and have the files directory outside the webroot. I'm getting a 404 Page cannot be found error when tring to download the file. It works in out test envirnoment just fine, but when I move into production, I get this error. Could it be an apache config problem, or an app problem? --~--~-~--~~~---~--~~ 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: getting a 404 with Media View
MediaView::render() fires a 404 if ... you guessed it--the file cannot be found. I had some similar trouble a while back (see link below). I placed a die(debug($path)) line just before that check and eventually figured out the problem is that is_dir() can use a relative path and it was throwing things off. I'm sorry that I can't remember the details better than that but I solved the problem by setting path param like so: 'path' = APP.$result['ItemFile']['directory'].DS, Although, if your app is working locally, perhaps the problem is simply that apache doesn't have read permission on that directory. But start with debugging the path to be sure it what you expect. http://groups.google.com/group/cake-php/browse_thread/thread/0f648c149c67bdcd/ec1f52e6f593017a?lnk=raotfwc=1 On Tue, Jul 28, 2009 at 10:37 AM, Stinkbugjustink...@gmail.com wrote: I'm assuming this is an apache config problem, but I'm not sure what could be causing it. Thought I'd just ask the community to see if anyone knew what the problem might be. I'm using the Media view to download files and have the files directory outside the webroot. I'm getting a 404 Page cannot be found error when tring to download the file. It works in out test envirnoment just fine, but when I move into production, I get this error. Could it be an apache config problem, or an app problem? --~--~-~--~~~---~--~~ 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 bally.z...@gmail.com wrote: On Wed, Jun 10, 2009 at 10:56 AM, Matt Currym...@mcurry.net 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 -~--~~~~--~~--~--~---
Media View and Caching
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 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 beyer.tho...@gmail.com 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 Caching
On Wed, Jun 10, 2009 at 10:56 AM, Matt Currym...@mcurry.net 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: trouble with Media view
I don't see how that would change anything, as it's the $id that's appended to $path. The issue appears to be that is_dir() can take a relative path. On Fri, May 1, 2009 at 5:04 PM, bram brammele...@gmail.com wrote: Did you try 'name' = 'test' (without extension)? I don't know why the parameters to the media view are that complicated... note that the extension should be lower case. In my application, the absolute path to the file is known. Even then, it's quite a hassle to get in properlly in the media template. I've used the following code: $path_parts = pathinfo($filepath); $params = array(); $params['id'] = $path_parts['basename']; $params['name'] = $path_parts['filename']; $params['extension'] = strtolower($path_parts['extension']); $params['path'] = $path_parts['dirname'] . DS; $params['download'] = true; On Apr 21, 6:30 am, brian bally.z...@gmail.com wrote: Mediaviewkeeps throwing up a 404 because of the following code: if (is_dir($path)) { $path = $path . $id;} else { $path = APP . $path . $id; } if (!file_exists($path)) { header('Content-Type: text/html'); $this-cakeError('error404'); } Here are my params, btw: Array ( [id] = test.jpg [name] = test.jpg [download] = 1 [extension] = jpg [path] = files/test/ ) That path is under APP, not WWW_ROOT, as it should be. What's happening is that is_dir() can take a relative path and so is checking relative tp APP and returning true. However, file_exists() must have an absolute path. When I changed my code to: 'path' = APP.$result['ItemFile']['directory'].DS Everything worked. I didn't see anything on bugtrac. Shouldn't this problem be cropping up for everybody that uses the recommended relative-to-app path?!? --~--~-~--~~~---~--~~ 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: trouble with Media view
Did you try 'name' = 'test' (without extension)? I don't know why the parameters to the media view are that complicated... note that the extension should be lower case. In my application, the absolute path to the file is known. Even then, it's quite a hassle to get in properlly in the media template. I've used the following code: $path_parts = pathinfo($filepath); $params = array(); $params['id'] = $path_parts['basename']; $params['name'] = $path_parts['filename']; $params['extension'] = strtolower($path_parts['extension']); $params['path'] = $path_parts['dirname'] . DS; $params['download'] = true; On Apr 21, 6:30 am, brian bally.z...@gmail.com wrote: Mediaviewkeeps throwing up a 404 because of the following code: if (is_dir($path)) { $path = $path . $id;} else { $path = APP . $path . $id; } if (!file_exists($path)) { header('Content-Type: text/html'); $this-cakeError('error404'); } Here are my params, btw: Array ( [id] = test.jpg [name] = test.jpg [download] = 1 [extension] = jpg [path] = files/test/ ) That path is under APP, not WWW_ROOT, as it should be. What's happening is that is_dir() can take a relative path and so is checking relative tp APP and returning true. However, file_exists() must have an absolute path. When I changed my code to: 'path' = APP.$result['ItemFile']['directory'].DS Everything worked. I didn't see anything on bugtrac. Shouldn't this problem be cropping up for everybody that uses the recommended relative-to-app path?!? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
trouble with Media view
Media view keeps throwing up a 404 because of the following code: if (is_dir($path)) { $path = $path . $id; } else { $path = APP . $path . $id; } if (!file_exists($path)) { header('Content-Type: text/html'); $this-cakeError('error404'); } Here are my params, btw: Array ( [id] = test.jpg [name] = test.jpg [download] = 1 [extension] = jpg [path] = files/test/ ) That path is under APP, not WWW_ROOT, as it should be. What's happening is that is_dir() can take a relative path and so is checking relative tp APP and returning true. However, file_exists() must have an absolute path. When I changed my code to: 'path' = APP.$result['ItemFile']['directory'].DS Everything worked. I didn't see anything on bugtrac. Shouldn't this problem be cropping up for everybody that uses the recommended relative-to-app path?!? --~--~-~--~~~---~--~~ 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) dereurom...@googlemail.com 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) dereurom...@googlemail.com wrote: nice :) thx On 31 Mrz., 15:17, Matt Curry m...@mcurry.net 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) dereurom...@googlemail.com 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
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) dereurom...@googlemail.com 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) dereurom...@googlemail.com 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
nice :) thx On 31 Mrz., 15:17, Matt Curry m...@mcurry.net 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) dereurom...@googlemail.com 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
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) dereurom...@googlemail.com wrote: nice :) thx On 31 Mrz., 15:17, Matt Curry m...@mcurry.net 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) dereurom...@googlemail.com 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 -~--~~~~--~~--~--~---
media view and files on the fly
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 bally.z...@gmail.com 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 m...@epubbooks.com 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 -~--~~~~--~~--~--~---
Media View not downloading unless I set headers
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=enlnk=gstq=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 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 m...@epubbooks.com 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=enlnk=gstq=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 -~--~~~~--~~--~--~---
Media view not working
So im trying to get this media view working, but it doesn't seem to force the download. All it does is show a white page and the query output, any ideas? Heres my action: /** * Downloads a file * @param int $upload_id * @return media */ function download($upload_id) { $this-view = 'Media'; $file = $this-Upload-find('first', array( 'conditions' = array('Upload.id' = $upload_id), 'contain' = array('Current') )); if (!empty($file)) { $this-Upload-increaseDownloadCount($file['Current']['id']); } $params = array( 'id' = $file['Current']['filename'], 'name' = $file['Upload']['name'] .' v'. $file['Current'] ['version'], 'download' = true, 'extension' = $file['Current']['type'], 'path' = 'files'.DS ); $this-set($params); } --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Media View - Acceptable Mime Types
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 - 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
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 -~--~~~~--~~--~--~---
media view with files on different server
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); } path 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 -~--~~~~--~~--~--~---
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); } path 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 -~--~~~~--~~--~--~---
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 -~--~~~~--~~--~--~---