views:

150

answers:

3

I upload file = Plupload . I checked varibles $_FILES, $_POST, $this->data , all is empty and !isset please help me

  function mod_uploadImg($id = null){
        if (!$id){
              return false;
        }
        if (!empty($_POST)){
              CakeLog::write('activity', 'file exist');
        }
        if (isset($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name'])){
              CakeLog::write('activity', 'file exist');
        }
        if (!empty($this->data)){
              CakeLog::write('activity', '$this->data');
        }

        if (!empty($_FILES)){
        CakeLog::write('activity', '$_FILES');
        }
  }

I have put multipart/form-data in form ( although script seem dont must put )

A: 

Did you put

enctype="multipart/form-data"

in your form declaration?

Iznogood
i did, $this->form(...,array('type'=>'file'... );
meotimdihia
@meoth that is not what Iznogood means. Please show the form's generated HTML code.
Pekka
hey, take a look http://pastebin.com/Uq7yJkhWthanks
meotimdihia
Adding type='file' in CakePHP actually adds enctype="multipart/form-data"
Nik
A: 

The problem is because you are using Ajax file upload. Ajax file upload actually created a hidden tag where there is normal form with file upload element.

This is the root of the problem. iframe look like a separate page and Firebug cannot handle the post of this request. Also the fields probably are totally different than Cake's convention.

I had the same problem in the past and I struggled with the same thing. :) My advise - use normal upload.

Nik
I know field are different with Cake's convention , I need grab data ajax that plupload uploaded
meotimdihia
Then try to mail it. At least you will see the results in your mail :)
Nik
A: 

Use: // Read binary input stream and append it to temp file $in = fopen("php://input", "rb");

meotimdihia