**Controller**

```
public function uploadFile()
{
      if(isset($_POST["uploadFile"])){
        $filePath = realpath($_FILES["file"]["tmp_name"]); //GETTING THE FULL PATH OF THE FILE WHICH WANTS TO BE SAVED INTO THE DB
        $arr = [];
            if (($handle = fopen($filePath, 'r')) !== FALSE){
                $i = 0;
                while (($lineArray = fgetcsv($handle, 4000)) !== FALSE){
                    for ($j=0; $j<count($lineArray); $j++){
                        $arr[$i][$j] = $lineArray[$j];
                    } $i++;
                } fclose($handle);
            }
        $csv = array_slice($arr,1);
        foreach($csv as $line){
          mysqli_query($mysqli, "INSERT INTO dialog(`eType`,`eVal`,`intent`,`reply`) VALUES('$line[0]','$line[1]','$line[2]','$line[3]')"); //FOR EACH LINE SAVE INTO THE DB
        }
      }
}

```

**Route**

```
Route::get('uploadFile', 'Chatbot\ChatbotController@uploadFile');

```

**View**

```
<form method="post" action="{{action('AltHr\Chatbot\ChatbotController@uploadFile')}}" enctype="multipart/form-data">
      <input type="file" name="file"> <br>
      <button type="submit" name="uploadFile" class="btn alt-btn-black btn-xs alt-btn">UPLOAD FILE</button>
</form>

```

So, Its my first day learning laravel, can somebody tell me why am I having this errror **MethodNotAllowedHttpException in RouteCollection.php**

I am trying to upload a **CSV** file in the form to the database. what am I doing wrong here ?