“客户端错误:`POST http://127.0.0.1:8000 / api / uploadDocs`导致`413有效载荷过大`

时间:2019-01-16 10:03:44

标签: laravel-5.6 guzzle6

使用guzzle要将文件上传到数据库。当我上传文件时,抛出以上错误。帮助我使用带有laravel 5.6的guzzle上传文件。

在UserController.php

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.3.11'
    ext.anko_version='0.10.7'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

在APIController.php

   $(document).ready(function(){
          $("#boutonAlerte").click(function(){
            var fname = $("#fname").val();
            var lname = $("#lname").val();
            var password = $("#password").val();
            var email = $("#email").val();
            var dataString = 'fname='+ fname + '&lname='+ lname + '&password='+ password + '&email='+ email;
            $.ajax({
            url: "http://localhost/RestApi/test.php",
            type: 'POST',
            data: dataString,
            cache: false,
            success: function(result){
              alert('You have successfully registered');
              window.location = "dashboard.html";
            }
            });
          });
        });

0 个答案:

没有答案