title: Extjs+PHP-File upload error- trying to decode an invalid JSON String:
body: <p>I am working in extjs+PHP[yii framework]. i am working on file upload control. i have view code as-</p>
  
  <pre><code>Ext.define('Balaee.view.kp.dnycontent.Content', 
  {
      extend:'Ext.form.Panel',
      requires:[
                'Balaee.view.kp.dnycontent.ContentView'
                ],
      id:'ContentId',
      alias:'widget.Content',
      enctype : 'multipart/form-data', 
      title:'This day in a history',
      items:[
          {
          xtype: 'fileuploadfield',
          hideLabel: true,
          emptyText: 'Select a file to upload...',
          //inputType: 'file',
          id: 'upfile',
          name:'file',
          width: 220
  }],
  
     buttons: [{
          xtype : 'button',
          fieldlabel:'upload',
          action:'upload',
          name:'upload',
          text: 'Upload',
          formBind:'true',
         handler: function() {
              var form = this.up('form').getForm();
              if(form.isValid()){
                  form.submit({
                      url: 'index.php/QuestionBank/Qbpaper/getFile',
                      waitMsg: 'Uploading your photo...',
                    //  uploadPath:'/app/model',
                      success: function(fp, o) {
                          Ext.Msg.alert('Success', 'Your photo "' + o.result.file + '" has been uploaded.');
                      }
                  });} } }]});
  </code></pre>
  
  <p>i had written above code to send file from extjs4. My server side is in PHP [Yii framework]. To server side i had written code to receive this file as-</p>
  
  <pre><code>public function actiongetFile()
      {
          $fileName = $_FILES['upfile']['name'];
          $fileSize = $_FILES['upfile']['size'];
          $fileType = $_FILES['upfile']['type'];
          $fp      = fopen($fileName, 'r');
          $content = fread($fp, filesize($fileName));
          $content = addslashes($content);
          fclose($fp);
          if(!get_magic_quotes_gpc()){
              $fileName = addslashes($fileName);
          }
  </code></pre>
  
  <p>But server side code is not working correctly. While sending file from extjs,its giving error as-"Ext.Error: You're trying to decode an invalid JSON String: 
  PHP notice
  Undefined index: upfile "
  So in php how to access file which is get send via extjs4. Please help me</p>