0
我上传图像,并试图在不保存图像的情况下获取图像的哈希值。Laravel 5获取上传图像的哈希值
foreach($request->only('photos') as $files){
foreach ($files as $file) {
if(is_file($file)) {
$fname = $file->getClientOriginalName();
$hash = file_get_contents($fname));
dd($hash);
}
}
}
我不断收到此错误:
"file_get_contents(1.jpg): failed to open stream: No such file or directory"
任何人都知道我怎样才能解决这个问题?
这个'$ content'是一个哈希字符串还是什么,因为我不能dd,这个代码发生在ajax调用 – Chris
我更新了我的答案,更多的信息。 –
顺便说一句,如果你只是在调试,你可以通过AJAX调用'dd()'来查看结果。使用您的浏览器工具,点击网络标签,然后点击AJAX请求。您将能够看到请求本身,包括参数和响应。 –