A web developer's blog. PHP, MySQL, CakePHP, Zend Framework, Wordpress, Code Igniter, Django, Python, CSS, Javascript, jQuery, Knockout.js, and other web development topics.

Monthly Archives: February 2013

Setting up File Uploader / FineUploader Basic with CakePHP

The configuration: <?php // app/Config/core.php Configure::write("App.SITE_URL", ‘http://www.mysite.com’); Configure::write("App.UPLOAD_PATH", ‘/usr/local/www/vhosts/mysite.com/httpdocs/app/webroot/uploads’); //no trailing slash Configure::write("App.UPLOAD_PATH_URL", ‘http://mysite/uploads’); //no trailing slash The setting up the .json and .txt extensions in the routes file. I need the txt. This is because Internet Explorer does not … Continue reading

Posted in Uncategorized | Leave a comment

CakePHP: Disabling the Security Component for Specific Actions in a Controller

Sometimes, I need to disable the Security component for certain actions in the controller. For example, if I need to handle FineUpload. If I do not disable the Security component, I get a “request has been blackholed” error. <?php class … Continue reading

Posted in Uncategorized | 1 Comment

CakePHP: Select Box / Drop-down List linked from related Model

For example, an Article has an Author. In the database, the Article table would have an author_id field. Assuming that we are following the CakePHP Model and Database Conventions (http://book.cakephp.org/2.0/en/getting-started/cakephp-conventions.html#model-and-database-conventions), the models would look something like these: <?php ## /Model/Article.php … Continue reading

Posted in Uncategorized | Leave a comment

CakePHP: Displaying images that are outside the public accessible directory (webroot) using Media Views

Let’s say that Configure::read(‘App.uploads_temp’) is somewhere outside the public accessible directory: /var/www/yourapp/private //This goes into the controller /** * @param $filename A filename without the path. EG: default-guy.jpg */ public function downloadimage($filename) { $file_parts = pathinfo($filename); $this->viewClass = ‘Media’; $params … Continue reading

Posted in Uncategorized | Leave a comment