上传后的laravel更改请求

时间:2016-10-24 09:08:28

标签: laravel laravel-5 laravel-5.3

上传文件后尝试更新我的请求:(Laravel 5.3)

$path = Storage::disk('s3')->putFile($destination, $request->file($name)); // works $request->merge(array($name => $path)); // doesn't work $myModel->update($request->all())

我知道我无法在请求中用字符串替换文件,所以我该怎么做?

看到很多帖子但很常见,必须比以下更容易:

$res = $request->except($myInputFileName) // turn it into array $res[$myInputFileName] = $path

任何漂亮的解决方案?

编辑:不是现在:将请求作为数组使用

2 个答案:

答案 0 :(得分:2)

为什么不单纯尝试这个

1) check to which artifact library you are connecting to. you must have access to the artifact library.  
 2) Try to get the plugin Manually and do mvn clean install
3) There might be an issue with eclipse itself. Do mvn clean install from cmd prompt and check.

答案 1 :(得分:0)

这样做:

$request[$name] = $path;

但是,我怀疑您是否希望将$name用作列名,因此您可能希望将$name$path保存到名称为file_name和{{1}的列中}} 例如?然后这样做:

file_path

您可以使用以下方法检查$request['name'] = $name; $request['path'] = $path; 内容:

$request