title: Yii2 file upload returns UPLOAD_ERR_PARTIAL
body: <p>Images fail to upload when I create a new item but on updating the newly created item the file is successfully uploaded. Any reasons?<br>
  <strong>Trending News Model</strong>  </p>
  
  <pre><code>class TrendingNews extends \yii\db\ActiveRecord
  {
      const EVENT_ADD_TRENDING_NEWS = 'add-trending-news';
        public $featuredFile;
  
        public function init() {
           $this-&gt;on(self::EVENT_ADD_TRENDING_NEWS, [$this, 'saveToLog']);
        }
      /**
       * @inheritdoc
       */
      public static function tableName()
      {
          return 'trending_news';
      }
  
      /**
       * @inheritdoc
       */
      public function rules()
      {
          return [
              [['headline_text','news_info', 'news_url', 'author', 'published', 'date_added', 'date_modified'], 'required'],
              [['headline_text', 'image_url', 'news_info', 'news_url'], 'string'],
              [['date_added', 'date_modified'], 'safe'],
              [['author'], 'string', 'max' =&gt; 20],
              [['published'], 'string', 'max' =&gt; 2],
              [['featuredFile'], 'file', 'skipOnEmpty' =&gt; false, 'extensions' =&gt; 'png, jpg'],
          ];
      }
  
      /**
       * @inheritdoc
       */
      public function attributeLabels()
      {
          return [
              'id' =&gt; 'ID',
              'headline_text' =&gt; 'Headline',
              'image_url' =&gt; 'Image Url',
              'news_info' =&gt; 'Source',
              'news_url' =&gt; 'News Url',
              'author' =&gt; 'Author',
              'published' =&gt; 'Published',
              'date_added' =&gt; 'Date Added',
              'date_modified' =&gt; 'Date Modified',
              'featuredFile' =&gt; 'Featured Image',
          ];
      }
  
      public function uploadBanner()
      {
          if ($this-&gt;validate()) {
             $ymd = date("Ymd");
             $save_path = \Yii::getAlias('@backend') . '/web/uploads/' . $ymd . '/';
              if (!file_exists($save_path)) {
                  mkdir($save_path, 0777, true);
              }
              $fileName = "trending_".Yii::$app-&gt;security-&gt;generateRandomString(20);
              $this-&gt;featuredFile-&gt;saveAs($save_path . $fileName .'.' . $this-&gt;featuredFile-&gt;extension);
              $this-&gt;image_url = $ymd . '/'. $fileName . '.' . $this-&gt;featuredFile-&gt;extension;
              return true;
          } else {
              return false;
          }
      }
  
      public function upload()
      {
          if ($this-&gt;validate()) {
             $ymd = date("Ymd");
             $save_path = \Yii::getAlias('@backend') . '/web/uploads/' . $ymd . '/';
              if (!file_exists($save_path)) {
                  mkdir($save_path, 0777, true);
              }
  
              $fileName = Yii::$app-&gt;security-&gt;generateRandomString(20);
  
              $this-&gt;featuredFile-&gt;saveAs($save_path . $fileName .'.' . $this-&gt;featuredFile-&gt;extension);
              $this-&gt;image_url = $ymd . '/'. $fileName . '.' . $this-&gt;featuredFile-&gt;extension;
              return true;
          } else {
              return false;
          }
      }
  
      public function beforeSave($insert)
      {
          if (parent::beforeSave($insert)) {
              if ($this-&gt;isNewRecord) {
                $this-&gt;date_added = date("YmdHis");
                $this-&gt;author =   Yii::$app-&gt;user-&gt;identity-&gt;id;
              } 
              else {
                 $this-&gt;date_modified = date("YmdHis"); 
              }
              return true;
          }
          else{
              return false;
          }
      }
  
      public function saveToLog($event)
      {
         //assigning attributes
         // echo 'mail sent to admin using the event';
         $app_log_model = new AppLog();
         $app_log_model-&gt;log_time = date("YmdHis");
         $app_log_model-&gt;log_activity = 'Added a trending news';
         $app_log_model-&gt;user_id = Yii::$app-&gt;user-&gt;identity-&gt;id;
         $app_log_model-&gt;device = "1";
         if ($app_log_model-&gt;save()) {
             return true;
         } else {
             return $app_log_model-&gt;getErrors() ;
         }
      }
  }
  </code></pre>
  
  <p><strong>usage</strong>  </p>
  
  <pre><code>public function actionCreate()
  {
      $model = new TrendingNews();
  
      if ($model-&gt;load(Yii::$app-&gt;request-&gt;post())) {
          $model-&gt;featuredFile = UploadedFile::getInstance($model, 'featuredFile');
  
          if(isset($model-&gt;featuredFile)){
              $model-&gt;upload();
              $model-&gt;save(false);
          } else {
              // file is uploaded successfully
              $model-&gt;save();
              //$model-&gt;trigger(BlogArticle::EVENT_EDIT_ARTICLE);
          }
          return $this-&gt;redirect(['view', 'id' =&gt; $model-&gt;id]);
      } else {
          return $this-&gt;render('create', [
              'model' =&gt; $model,
          ]);
      }
  }
  public function actionUpdate($id)
  {
      $model = $this-&gt;findModel($id);
  
      if ($model-&gt;load(Yii::$app-&gt;request-&gt;post())) {
          $model-&gt;featuredFile = UploadedFile::getInstance($model, 'featuredFile');
          if(isset($model-&gt;featuredFile)){
              $model-&gt;upload();
              $model-&gt;save(false);
          } else {
              $model-&gt;save();
          }
          return $this-&gt;redirect(['view', 'id' =&gt; $model-&gt;id]);
      } else {
          return $this-&gt;render('update', [
              'model' =&gt; $model,
          ]);
      }
  }
  </code></pre>
  
  <p>the app log shows this</p>
  
  <pre><code>$_FILES = [
      'TrendingNews' =&gt; [
          'name' =&gt; [
              'featuredFile' =&gt; 'another_evento.jpg'
          ]
          'type' =&gt; [
              'featuredFile' =&gt; ''
          ]
          'tmp_name' =&gt; [
              'featuredFile' =&gt; ''
          ]
          'error' =&gt; [
              'featuredFile' =&gt; 3
          ]
          'size' =&gt; [
              'featuredFile' =&gt; 0
          ]
      ]
  ]
  </code></pre>
  
  <p><code>featuredFile</code> is not a database field
  Is there something that is being done wrong?
  I am using xampp,tried on a live server and the issue is same</p>