如何使用Slime v2.3上传文件

时间:2019-04-30 12:38:36

标签: php slime

我正在尝试通过史莱姆v2从android上传类似.mp4的文件,但出现此错误:

  

“未捕获的错误:调用未定义的方法Slim \ Http \ Request :: getUploadedFiles”

我尝试使用$_FILES['myFile'],但是我有“未定义索引:myFile”

我的代码是:

$app->post('/uploadvideo', 'authenticate',function () use ($app)
{
    // global $user_id, $username, $profileName;
    // $db       = new DbHandler();
    // $uploader = new FileUploader();

    //$image = $app->request->params('image');
    //$mapper = new DatabaseMapper($this->db);
    //$post = $app->request->getParsedBody();
    //$files = $app->request->getUploadedFiles();
    // if (empty($files['my_file'])) {
        // throw new Exception('No file has been send');
    // }
    $data = $app->request->getUploadedFiles();


    //$file_name    = $app->request->files('name');
    //$temp_name    = $app->request->params('tmp_name');
    //$file_name = $_FILES['myFile']['name'];
    //$temp_name = $_FILES['myFile']['tmp_name'];

    echoRespnse(200, $response);
});

我做错了什么以及如何解决?

0 个答案:

没有答案