file upload strange - doesn't appear in filesystem, but can be move_uploaded_file()ed
Hi, I haven't done any file upload handling for a long time in php, so maybe I am missing something quite obvious here. I have a simple upload form using the form helper that seems to work. My controller then calls a model function called "data_upload" which is responsible for moving the uploaded file using move_uploaded_file. This suceeds and I have now have the chosen file in my /files/ folder - everything seems fine. However, my Model validation calls on the php method "is_uploaded_file" which is passed the same file path/name as the move_uploaded_file - which returns false. I also cannot find the suggested temp file anywhere on my computer (local server). Removing the move_uploaded_file makes is_uploaded_file return true, but still I cannot find the temp file anywhere. Doing the move after the is_uploaded_file puts the file in the right place, but makes the is_uploaded_file return false. I have checked php.ini and file uploads are on, and the tmp file is the one where I am looking - I also checked my whole C:\ for any possible temp file and found nothing. I assume this is something to do with caching uploads? I am running xampp on windows 7. --~--~-~--~~~---~--~~ 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: Friendly image/files URL routing
Thanks! Now I know where to start I will investigate further correct use/mime- types of the function. On Aug 26, 2:30 pm, Jon Bennett wrote: > Hi, > > > I am uploading files(images, mp3s etc) to my webroot /files/ folder. > > The files are named ".". Without any > > custom routing I can access these files by "/files/343.png". > > > I would like to access this file by using the URL "/files/343- > > sometitle.png" as well. At the moment I can do this by using a custom > > route and an action, but this just redirects and so the URL displays "/ > > files/343.png" - I would like the URL to not change and for the file > > to be displayed as it would be normally. > > You're nearly there. What you need to do is use echo > file_get_contents() in a controller method, eg: > > public function img($filename='') > { > $this->autoRender = false; > > // check file exists > if (!file_exists(WWW_ROOT.'files'.DS.$filename)) > return; > > // output file - very crude as it is, you'd want to set the correct > header/mime type etc > echo file_get_contents(WWW_ROOT.DS.'files'.DS.$filename); > > } > > this only checks for a file with a real name, you'll want to strip out > anything other than the ID.ext > > hth > > Jon > > -- > > jon bennett > w:http://www.jben.net/ > iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Friendly image/files URL routing
Hi, I am uploading files(images, mp3s etc) to my webroot /files/ folder. The files are named ".". Without any custom routing I can access these files by "/files/343.png". I would like to access this file by using the URL "/files/343- sometitle.png" as well. At the moment I can do this by using a custom route and an action, but this just redirects and so the URL displays "/ files/343.png" - I would like the URL to not change and for the file to be displayed as it would be normally. Can this be done using just a route? I have tried variations of the below custom route, but it would seem routes must have a controller/ action url. Router::connect('/files/:id-:title.:ext', array('url' => '/ files/:id.:ext'), array('id' => '[0-9]*', 'title' => '[a-zA-Z0-9\-_ ]*', 'ext' => '[a-zA- Z0-9]*')); Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: routes.php: Where do the errors go?
In production mode (Debug = 0), Cake just displays the generic 404 error view I believe. From there you could work which part of the url is wrong if you wanted, or just display the same view for either type (or other) of error. On Jul 24, 6:11 pm, mark_story wrote: > Well if the request doesn't match any user land routes, cake tries to > use its default routes. If those generate errors, that's what > happens. > > -Mark > > On Jul 24, 10:23 am, DragonFlyEye wrote: > > > OK, I'm trying to figure this out and getting wacky results as I test: > > I'm playing with custom-built routes in the following format: > > > /:town-name/:action/:id > > > The route works fine for correct URLs, but I'm confused as to what > > CakePHP does with URLs which don't conform to the regex included in > > the third argument to the Router::connect() method. Here is my code: > > > Router::connect( > > '/:town-name/:action/:id', > > array('controller' => 'potholes'), > > array( > > 'town-name' => '[a-z/-]+', > > 'id' => '[a-z/-]+')); > > > If I put in an erroneous URL like /roch3ster/view/this-post, I get the > > error "Roch3sterController could not be found." If I put one in that > > messes up the third parameter, /rochester/view/bo3ogers, I get > > "RochesterController could not be found." > > > It may be that some of the other routing I'm doing is messing up the > > show. But can anyone tell me what the expected behavior aught to be? > > --~--~-~--~~~---~--~~ 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: TinyMCE Integration - Issue with CSS paths due to Cake Themes
After debuging whatever $html->css('main') echoed out and trying that, I seem to have everything working. "/proj/cake/cccms/css/main.css" which is the absolute path (localhost/ proj/cake/...) I believe. Leaving this post up on the off chance anyone else needs help with this. On Jul 22, 8:57 pm, MrMeikel wrote: > Hi, I have posted this in the CakePHP group as I believe my issue with > cakephp paths. > > I'm working on integrating TinyMCE into my cake application. > Everything seems to be working fine apart from the content_css which > you define as the relative path to your css file. > > The TinyMCE documentation states this is the relative path from the > file that executes this script - I'm not sure what this refers to due > to the CakePHP routing/framework. Also I am using themes in my > application, which further complicates the issue. > > My folder structure is as follows: > > /app/ > ./views/elements/tinymce.ctp - this element inits TinyMCE and contains > the content_css definition. > ./webroot/themed/ccd/css/main.css - is the css file I am trying to > link to > > The actual page in the address bar is "/admin/pages/edit/static", but > I do not think this affects what my content_css value is. > > So far I have tried many different paths, including "css/main.css", > "themed/ccd/css/main.css", "/webroot/themed/ccd/css/main.css" and some > others. Any help with this would be greatly appreciated. The > integration of TinyMCE in my project is very simple, and I cannot see > any errors elsewhere at the moment. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
TinyMCE Integration - Issue with CSS paths due to Cake Themes
Hi, I have posted this in the CakePHP group as I believe my issue with cakephp paths. I'm working on integrating TinyMCE into my cake application. Everything seems to be working fine apart from the content_css which you define as the relative path to your css file. The TinyMCE documentation states this is the relative path from the file that executes this script - I'm not sure what this refers to due to the CakePHP routing/framework. Also I am using themes in my application, which further complicates the issue. My folder structure is as follows: /app/ ./views/elements/tinymce.ctp - this element inits TinyMCE and contains the content_css definition. ./webroot/themed/ccd/css/main.css - is the css file I am trying to link to The actual page in the address bar is "/admin/pages/edit/static", but I do not think this affects what my content_css value is. So far I have tried many different paths, including "css/main.css", "themed/ccd/css/main.css", "/webroot/themed/ccd/css/main.css" and some others. Any help with this would be greatly appreciated. The integration of TinyMCE in my project is very simple, and I cannot see any errors elsewhere at the moment. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Simple Authentication - Verifying Login Status
Hi, I'm wanting to create a simple authentication system for use with ACL. I do not believe the Auth component is suitable for this, as my ACL setup is not based on controller/actions and is quite strange in general. I currently have a system such as that described in http://bakery.cakephp.org/articles/view/simple-form-authentication-in-1-2-x-x at the moment, however before the application is released into the wild I would just like to ask about a couple of security concerns with this system. I understand that this system is very simple, basically consisting of a login() and __validateLoginStatus() functions. My concern with the implementation is that can't a 3rd party just repeatedly try different SessionIDs until successful, as when validating the current login status, it just checks to see if there is a Session variable defined for "User". Isn't this open to abuse? What would be a more secure method of validation. (Actual logging in seems fine (ish) - apart from packet sniffing where the username/password combo could be picked up, but as not every site in the world uses SSL I assume this isn't such an issue.) I think I have confused myself with this problem, and am probably looking at this incorrectly. I blame my inexperience, and the opiates they gave me after my operation earlier. --~--~-~--~~~---~--~~ 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 keep Session data clean and not messed up
(Apologies if I have missed the point...) If you only want to save information when the user has gone from pageA directly to pageB, couldn't you use $_POST? Sounds like you're using a form anyway, so just set the target to pageB and check the (correct) information has been passed - ie. posted from pageA. On Jul 19, 1:43 pm, Raph wrote: > Let's say I've got an exmaple application, and in this application > there are a few wizards. User goes to one of the wizards, inputs data > in form in step 1, then goes to step 2. Data from step 1 was saved in > session. Now user should do somehting in step 2 and go to step 3, but > he dosen't do that. He clicks "back" button in his browser, or maybe > he types url in address bar and goes to place in the system outside > the wizard. > > The problem is those data in session. It wasn't removed and it still > there. User could go to another wizard and do the same thing and new > unnecessary data appear in session. > > How you handle situations like that? > > -- > Raph --~--~-~--~~~---~--~~ 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: After moving from windows to Ubuntu, getting Missing View error
Not very experienced with Linux. But my first guess would be that Linux uses case-sensitive file names - check all your views to make sure they are correctly cased (I do not know what the correct casing is in this situtation). On Jul 14, 8:24 am, Prabu wrote: > Hi, > > I just moved my cake app folder from windows to ubuntu and getting > this error : missing view (could not find .ctp) > > In my controller I have two methods like this: > > function foo1($viewtype = null) { > // loads data here... > $this->render($viewtype, 'ajax'); > } > > function foo2() { > $this->Session->write('abcd', "\\"); > $this->foo1(); > } > > when I call gohome it throws the MissingView error. > > It was working correctly in windows. > > Anyone faced such 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 -~--~~~~--~~--~--~---
Issues with validation with hasOne associating - values passed from form
(I have been googling furiously for a while now, and cannot see what I am doing wrong at the moment. Apologies if it is something obvious! Also I hope I have followed the naming conventions, this could also be an issue) I have a belongsTo/hasOne relation set up between page and page_meta tables. The page_meta table contains a page_id foreign key (and a primary id key). When creating a page record, a page_meta record should also be created, and the data for both records is being passed from a form (created using the formhelper). My issue is that the page_meta validation rules don't seem to functioning correctly. In pagemeta.php I have a classed defined called PageMeta, in which my array $validate contains: 'limit_per_page' => array( 'notEmpty' => array( 'rule' => 'notEmpty', 'message' => 'Limit per page must not be blank.' ) ),... There are more validation rules, which don't seem to be functioning either, but they have been cut for brevity. PageMeta has a $belongsTo relation with Page (foreignKey => page_id) and Page has a hasOne relation with PageMeta. (Not all Page's have PageMeta's entries, I don't think this is related to my problem though.) The PagesController does "$this->Page->set($this->data);" and then attempts to validate both models. I have tried 3 different methods of validation here, and in all cases validation is 'correct' on the Page data, and doesn't function at all for PageMeta data. By doesn't function, I mean that $this->Page->PageMeta->validates() returns 1 even when $this->data['PageMeta']['limit_per_page'] is empty. $this->Page->saveAll($this->data, array('validate' => 'only') also returns true when it shouldn't. If I actually attempt to save (with invalid fields in PageMeta), the Page data is saved and then the PageMeta query displays a MySQL error at the top of the page "limit_per_page must be not null" or similar. I've been playing around with this for a few hours now, and not really getting anywhere. If both Model's data is correct, the records are created as expected. Sorry for the extra-long post! Any help would be greatly appreciated! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---