du5591 2017-09-16 12:08
浏览 46
已采纳

Laravel文件扩展名为数组值

I am trying to get the file extension of the files from the multiple file input array.

I tried to use File::extension() but it expects a string and I have an array.

I don't need this value for the validation so I can't use Laravel validation. Thanks

  • 写回答

2条回答 默认 最新

  • dongqi6964 2017-09-16 12:16
    关注

    I am trying to get the file extension of the files from the multiple file input array.

    Then loop over the $_FILES array.

    foreach ($_FILES as $key => $file) {
        $extensions[$key] = \File::extension($file['name']);
    }
    

    The above presumes no fancy/opinionated $_FILES structure mutations ;p

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 有人会SIRIUS 5.8.0这个软件吗
  • ¥30 comsol仿真等离激元
  • ¥15 静电纺丝煅烧后如何得到柔性纤维
  • ¥15 (标签-react native|关键词-镜像源)
  • ¥100 照片生成3D人脸视频
  • ¥15 伪装视频时长问题修改MP4的时长问题,
  • ¥15 JETSON NANO
  • ¥15 VS开发qt时如何在paintgl函数中用pushbutton控制切换纹理
  • ¥20 关于 openpyxl 处理excel文件地问题
  • ¥15 MS中不知道高分子的构型怎么构建模型