Friday, June 29, 2012

Re: Undefined index after web host install.

On Fri, Jun 29, 2012 at 3:01 PM, Guti Grewal <gutigrewal@googlemail.com> wrote:
> Notice (8): Undefined index: Upload [APP/Controller/UploadsController.php,
> line 32]
>
> /app/Controller/UploadsController.php (line 32)
>
> null
>
>
> This is what I get, when I do the debug, so Im guessing theres no errors
> with the coding. Where else could the error be.

Well, no, it doesn't mean there are no errors. It means that
$this->request->data is empty. Which is not what you want. Where did
you put this line? Normally, it would be something like:

public function add()
{
if (!empty($this->request->data))
{
// do save here
debug($this->request->data);


Which version are you running, btw? If less than 2.x you need to
debug($this->data) instead.

It's odd that both the notice and the debug are on line 32. What does
your controller action look like?

> It works fine in localhost but once I uploaded it to the online web host I
> get thrown this error.

Then maybe the problem is that you're trying to upload a file that's
too large. Or you may not even be able to upload at all. Add this in
your controller:

debug($_FILES);

If there's an upload error it'll be included there and you can compare
with the examples on the PHP site.

Also, you could check the server's config. Write a script, info.php,
and stick it in your webroot dir:

<?php
phpinfo();

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