Friday, March 4, 2011

Re: image upload via iphone app

"post it to a URL handled by a controller implementing the uploader,"

This is what I don't know how to do. Currently the controller is
handling the upload and just placing the file into a folder.

My code.
function app_photo() {
// what layout to use
$this->layout = 'ajax';

// this helps determine any errors
error_reporting(E_ALL);
ini_set("display_errors", 1);

$target_path = WWW_ROOT .'media/transfer/img/';
$target_path = $target_path . $_FILES['media']['name'];

// if we moved the image reply with the image name
if(move_uploaded_file($_FILES['media']['tmp_name'],$target_path)) {
echo basename( $_FILES['media']['name']);
}
}

My guess is that after I have moved the file would try to invoke the
media plugin to duplicate the file, create the proper sizes and
deposit them in the proper folders. But how do I tell the plugin to do
that?

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: