On Feb 3, 2011, at 15:53, Foroct wrote:

> I am trying to push content to my cakePHP site from an iphone app
> using json. I've been successful when pushing text (like adding a new
> user) but I an trying to push text and an image.  The problem I am
> having is I don't know how to include an enctype of “multipart/form-
> data” within the controller and call out the $_POST['photo'] to ensure
> that cake knows its an image.  Since there is nothing in my view there
> is no way for me to set it there.

Setting the form's enctype to multipart/form-data does nothing more than send 
that text to the browser. It's then up to the browser to read it and realize 
that this means it needs to send the form's data to the server in a different 
format, one that works for binary data (like images).

In your case, there is no browser; there is an iOS app. So it's up to you to 
write your iOS app in such a way that it delivers properly-formatted data to 
the web server. If you want to receive your data in CakePHP as if it were 
coming from a multipart/form-data web browser form, then you'll need to 
investigate how to send data in that format from an iOS app.



-- 
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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to