cakephp on domains does not work

2014-04-05 Thread AugustoA
Hi guys,
I`m having a problem here, when I run the cakephp in my domain name I 
receive a 404 error message.
When I do the same call from the IP I get the cakephp to run.
Does anyone had this kind of problems?

thanks a lot
Augusto Arnold

-- 
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/d/optout.


RE: Miles Johnson Uploader saves corrupt (empty) images

2014-04-05 Thread Advantage+
I had the same issue but rather than dealing with I just made the folder on the 
server. 

Not the best solution but hey if your uploading pics to a specific folder just 
make the folder.

 

Dave 

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of 
schnauss
Sent: Saturday, April 05, 2014 6:21 PM
To: cake-php@googlegroups.com
Subject: Re: Miles Johnson Uploader saves corrupt (empty) images

 

What are the contents of the file that gets uploaded?

 

I've been having a similar problem. I upload an image, but the resulting file 
is 900b and consists only of my HTTP PUT request.

On Friday, April 4, 2014 12:10:51 AM UTC-4, seba wrote:

I'm using the Miles Johnson Uploader to upload and resize images. I'm finding 
that images are being uploaded to the correct location and the respective 
database table column is being updated with the correct path and file name, 
however, the images that are being saved to the server directory are 
effectively empty and corrupt (i.e. I upload a 500KB image, that ends up being 
6KB in size once uploaded, and when I go to open it, I get the file is corrupt 
message). 

Note:  I've removed the resize config temporarily whilst I have this corrupt 
image issue, hence there's no config below for it.

 

I've provided the relevant code snippets below, but any advice to help resolve 
this issue around why my app's uploading empty/corrupt images is much 
appreciated.

 

Here is the upload code in my model file:

 

At the top of the model file:

 

 App::uses('AppModel', 'Model','AttachmentBehavior');

And the configuration further down the model file:

 public $actsAs = array(

  'Uploader.Attachment' => array(

  'image' => array(

   'prepend' => 'logo-',

   'tempDir' => TMP,

   'uploadDir' => '/full-path-to/app/webroot/img/uploads/',

   'finalPath' => '/img/uploads/',

   'dbColumn' => 'image',

   'overwrite' => true,

   'stopSave' => true,

   'allowEmpty' => true

  )

  ),

  'Uploader.FileValidation' => array(

'image' => array(

'extension' => array('gif', 'jpg', 'png', 'jpeg'),

'type' => array('image'),

'filesize' => 5242880

)

  )

 );

 

Here is the code for the image input field only (fyi - the image field is one 
of many in the form) in the view. I'm using Bootstrap, hence the additional 
formatting:

 

  echo $this->Form->input('image', array(

   'fieldset' => false,

   'label' => false,

   'before' => 'Image',

   'after' => '',

   'class' => 'form-control',

   'type' => 'file',

   'div' => 'form-group',

   'error' => array(

'attributes' => array(

 'wrap' => 'div', 'class' => 'alert 
alert-danger'

  )

)

  )

  ); 

 

 

Finally, here is the controller code:

 



 public function edit($id = null) {

  

  if (!$this->ModelName->exists($id)) {

  throw new NotFoundException(__('Invalid ModelName'));

  }

  if ($this->request->is(array('post', 'put'))) {

  if ($this->ModelName->save($this->request->data)) {

   $this->Session->setFlash(__('The ModelName has been 
saved.'), 'default', array('class' => 'alert alert-success'));

   return $this->redirect(array('action' => 'index'));

  } else {

   $this->Session->setFlash(__('The ModelName could not be 
saved. Please, try again.'), 'default', array('class' => 'alert alert-danger'));

  }

  } else {

  $options = array('conditions' => array('ModelName.' . 
$this->ModelName->primaryKey => $id));

  $this->request->data = $this->ModelName->find('first', $options);

  }

 }

 

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 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/d/optout.

-- 
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 i

Re: Miles Johnson Uploader saves corrupt (empty) images

2014-04-05 Thread schnauss
What are the contents of the file that gets uploaded?

I've been having a similar problem. I upload an image, but the resulting 
file is 900b and consists only of my HTTP PUT request.

On Friday, April 4, 2014 12:10:51 AM UTC-4, seba wrote:
>
> I'm using the Miles Johnson Uploader to upload and resize images. I'm 
> finding that images are being uploaded to the correct location and the 
> respective database table column is being updated with the correct path and 
> file name, however, the images that are being saved to the server directory 
> are effectively empty and corrupt (i.e. I upload a 500KB image, that ends 
> up being 6KB in size once uploaded, and when I go to open it, I get the 
> file is corrupt message). 
> Note:  I've removed the resize config temporarily whilst I have this 
> corrupt image issue, hence there's no config below for it.
>
> I've provided the relevant code snippets below, but any advice to help 
> resolve this issue around why my app's uploading empty/corrupt images is 
> much appreciated.
>
> *Here is the upload code in my model file:*
>
> At the top of the model file:
>
> App::uses('AppModel', 'Model','AttachmentBehavior');
>
> And the configuration further down the model file:
> public $actsAs = array(
> 'Uploader.Attachment' => array(
> 'image' => array(
> 'prepend' => 'logo-',
> 'tempDir' => TMP,
> 'uploadDir' => '/full-path-to/app/webroot/img/uploads/',
> 'finalPath' => '/img/uploads/',
> 'dbColumn' => 'image',
> 'overwrite' => true,
> 'stopSave' => true,
> 'allowEmpty' => true
> )
> ),
> 'Uploader.FileValidation' => array(
> 'image' => array(
> 'extension' => array('gif', 'jpg', 'png', 'jpeg'),
> 'type' => array('image'),
> 'filesize' => 5242880
> )
> )
> );
>
> *Here is the code for the image input field only (fyi - the image field is 
> one of many in the form) in the view. I'm using Bootstrap, hence the 
> additional formatting:*
>
> echo $this->Form->input('image', array(
> 'fieldset' => false,
> 'label' => false,
>  'before' => 'Image class="col-sm-9">',
>  'after' => '',
>  'class' => 'form-control',
>  'type' => 'file',
>  'div' => 'form-group',
>  'error' => array(
>  'attributes' => array(
>  'wrap' => 'div', 'class' => 'alert alert-danger'
>   )
>  )
> )
> ); 
>
>
> *Finally, here is the controller code:*
>
>  public function edit($id = null) {
>  if (!$this->ModelName->exists($id)) {
> throw new NotFoundException(__('Invalid ModelName'));
> }
> if ($this->request->is(array('post', 'put'))) {
> if ($this->ModelName->save($this->request->data)) {
> $this->Session->setFlash(__('The ModelName has been saved.'), 'default', 
> array('class' => 'alert alert-success'));
> return $this->redirect(array('action' => 'index'));
> } else {
> $this->Session->setFlash(__('The ModelName could not be saved. Please, try 
> again.'), 'default', array('class' => 'alert alert-danger'));
> }
> } else {
> $options = array('conditions' => array('ModelName.' . 
> $this->ModelName->primaryKey => $id));
> $this->request->data = $this->ModelName->find('first', $options);
> }
> }
>
> 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 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/d/optout.


Re: iOS app development

2014-04-05 Thread Борислав Събев Borislav Sabev
You're talking about json responces so I suppose as an overall service 
pattern you are using REST?

1. For the redirects
Well in that case, REST dictates that you need to use HTTP's facilities. I 
am saying this especially for the redirects.
You don't need to send redirects as information in JSON - just send the 
redirect header and have the iOS application
handle it as a HTTP header.

2. About $this->request->isMobile() and the simulatior

99% it is because of the simulator. Check out the code in isMobile() and 
then make the simulator simulate it better. :D 
Try NOT TO change the code in isMobile() but rather see why the simulator 
is not being recognize. Then try to make to simulator pass whatever is 
needed so it is recognized.

3. The RequestHandler in general

This Component is there to assist you in recognizing properties of 
requests. Generally it is used " to obtain additional information about the 
HTTP requests that are made to your applications".
Think of it as a wrapper that 

5. CakePHP & iOS resources

I don't think there are specific resources for interoperability.
The basic idea is a Client - Server application. Let's say you use REST.
Client is iOS. As far as I know most people use RestKit 
as a 
service consumer.
On the server side you will always have a Service - doesn't really matter 
if it is CakePHP or .NET.

Client recognition also ties in here. You are not obliged to use only the 
isMobile() method.
I would actually encourage you to add a custom way for your server to know 
that it is your App since you are developing the Server and App at the same 
time.
But this is a big IF.
This way the API is always sure that your App is calling it - isMobile() 
will return true even If you call your API from an Android device.
This could be:
- a custom header that the iOS App always sends in all of your requests
- an extension of RequestHandler in a method like 'isMyApp()' which will 
inspect requests for the header

This tactic could be a double-edged knife and you should always use it in 
conjuction with isMobile().
Watch out how exactly you implement this, because you may end up chaining 
your Service to your App - which is not the envisioned result of this 
approach and should be avoided.

Cheers,
   Borislav.


On Thursday, 3 April 2014 13:28:54 UTC+3, Jeremy Burns wrote:
>
> We're developing an iOS app alongside a CakePHP web app. At this point the 
> iOS developer is using the XCode simulator. I have some questions about how 
> the PHP code should be altered to handle requests from iOS. We are learning 
> as we go along...
>
> - When I do a check for $this->request->isMobile() the result is false; is 
> that because we are using the simulator?
> - When the right data is posted from the log in screen the users 
> controller redirects the user to the next page. The iOS app is receiving 
> the full HTML of that page. Do I need to put isMobile() checks throughout 
> my PHP code and return different responses? See the false isMobile check 
> above.
> - What part does the RequestHandler component play in this? I have 
> included it in AppController.
> - The CakePHP app contains al the correct redirects and logic flow. Does 
> the iOS app need to replicate these (in other words, the logic is stored in 
> two places) or can the CakePHP code drive the redirect equivalent 
> statements for iOS?
> - Are there any good resources for co-developing iOS and CakePHP apps?
>

-- 
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/d/optout.


Re: Using ODBC Data Source in Cake 2.4

2014-04-05 Thread Борислав Събев Borislav Sabev
Now that i searched a bit more I saw that There is a Datasources plugin for 
CakePHP 2.0  but the 
`Database/Odbc` data source is still incompatible with CakePhp 2.x.
*So you should definitely start there!*

I also answered your StackOverflow 
Questionin
 the same way as here. Posting it as reference.

Cheers, Borislav.

On Friday, 4 April 2014 00:29:30 UTC+3, Comrade Raj wrote:
>
> Hi, I am newbie to Cake. I have a DSN pointing to Teradata.
> How can I configure database.php to use that ODBC DSN. I am currently uing 
> Cake 2.4.6
>
> Thanks alot.
>

-- 
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/d/optout.


Re: Using ODBC Data Source in Cake 2.4

2014-04-05 Thread Борислав Събев Borislav Sabev
Well I don't think there is any support out of the box but I may be very 
wrong.
Can someone who knows the core super well answer?

Otherwise you can extend the DboSource and connect throgh a PDO just like 
in this example:

https://gist.github.com/ceeram/3062745

- check the 

function connect() {..


Keep in mind that this example is UNSTABLE and most-probably very outdated 
but it can get you started.

Keep in mind that PDOs  have a ODBC 
Driver .
There is also a seperate Abstraction Layer (like PDO) but for 
ODBCbut it is know for some issues - 
for example, incompatibility with the 
package php-recode for some reason.

Anyway, in order to connect to your DSN you can use PDO_ODBC 
DSN

I personally think it is better to access the ODBC DSN through PDO, however 
your usage scenario way dictate otherwise.

I will wait for the others to answer.

On Friday, 4 April 2014 00:29:30 UTC+3, Comrade Raj wrote:
>
> Hi, I am newbie to Cake. I have a DSN pointing to Teradata.
> How can I configure database.php to use that ODBC DSN. I am currently uing 
> Cake 2.4.6
>
> Thanks alot.
>

-- 
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/d/optout.