【问题标题】:Laravel: error while trying to upload multiple filesLaravel:尝试上传多个文件时出错
【发布时间】:2021-05-26 19:58:26
【问题描述】:

我正在尝试上传多张图片,但不幸的是,我收到了错误“消息”:“文件“phpzP428U.png”不存在”,我该如何解决这个问题?谢谢。

返回请求

dd($request->all())

收件箱控制器

  foreach ($request["file"] as $key => $value) {
      $file = Storage::disk('yourstitchart')->putFile('', $value);
      array_push($files, $file);
    }

    foreach ($request["users"] as  $key => $users) {
      $digitzingInbox = new Inbox;
      $digitzingInbox->file = json_encode($request[$files]);
      $digitzingInbox->order_id = $request->order_id;
      $digitzingInbox->order_name = $request->order_name;
      $digitzingInbox->width = $request->width;
      $digitzingInbox->height = $request->height;
      $digitzingInbox->placement = $request->placement;
      $digitzingInbox->format = $request->format;
      $digitzingInbox->fabric = $request->fabric;
      $digitzingInbox->instruction = $request->instruction;
      $digitzingInbox->to_user = $users;
      $digitzingInbox->from_user = Auth::user()->id;
      $digitzingInbox->type = 2;
      $digitzingInbox->save();
    }

【问题讨论】:

  • 您是否在表单中设置了enctype="multipart/form-data"

标签: laravel


【解决方案1】:

我认为它不言自明,该文件可能不存在于文件夹中。如果匹配,请查找名称。

【讨论】:

    猜你喜欢
    • 2013-05-31
    • 2023-02-21
    • 2017-08-27
    • 1970-01-01
    • 1970-01-01
    • 2022-06-23
    • 2020-10-01
    • 2011-06-02
    • 2020-11-11
    相关资源
    最近更新 更多