作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经尝试了一段时间,但没有成功
后端
public function createInspection(Request $request) {
$path = Storage::disk('public')->putFile('bin_images', new File($request->file('image')));
return $path;
}
data.append("image", {
uri: this.state.images[0].path,
type: this.state.images[0].mime,
size: this.state.images[0].size,
name: filename
});
this.props.sendInspection(data)
const res = await axios.post(url, data, {
headers: {
Authorization: `Bearer ${token}`,
Accept: "application/json",
"Content-Type": "multipart/form-data"
}
});
/private/var/mobile/Containers/Data/Application/B6FEB0FD-F9C8-4088-B15F-99D27A818C76/tmp/react-native-image-crop-picker/7BD81594-30E0-4E00-919C-4F353BBDE46F.jpg
message: "The file "" does not exist", exception: "Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException", file: "/Users/ysr/tza-project/vendor/symfony/http-foundation/File/File.php", line: 37, file: "/Users/ysr/tza-project/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php", line: 116
最佳答案
问题似乎出在您的后端,请检查documentation。
您应该执行以下操作:
public function update(Request $request)
{
$path = $request->file('image')->store('images');
return $path;
}
putFile
,则可以使用:
$path = Storage::putFile('images', $request->file('image'));
$path = Storage::disk('public')->putFile('images', $request->file('image'));
关于ios - 无法上传图片(React native,Laravel),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52103753/
我有以下正则表达式 /[a-zA-Z0-9_-]/ 当字符串只包含从 a 到z 大小写、数字、_ 和 -。 我的代码有什么问题? 能否请您向我提供一个简短的解释和有关如何修复它的代码示例? //var
我是一名优秀的程序员,十分优秀!