in this case , when im add , i can access my file , but when im try to edit and update, my file was not found in this server
Sep 17, 2020
26
Level 1
The requested resource file.pdf was not found on this server.
Hi, i have a problem with mycode, this case i want to Edit and update my image or file.pdf, but when im upload a pdf file or jpeg , i not see a error , but when im acces a file , i got notice like this
The requested resource file.pdf was not found on this server.
this is my Controller
public function update(Request $request, $id)
{
$this->validate($request, [
'content' => 'required',
]);
$papan = Papan::findorfail($id);
if($request->has('gambar')){
$gambar=$request->gambar;
$new_gambar=time().$gambar->getClientOriginalName();
$gambar->move('public/uploads/papan/'.$new_gambar);
$post_papan = [
'content' => $request->content,
'gambar' => 'public/uploads/papan/'.$new_gambar
];
}
else{
$post_papan = [
'content' => $request->content
];
}
$papan->update($post_papan);
return redirect()->route('papan.index')->with('Berhasil', 'Pengumuman Berhasil Diperbarui');
}
Level 54
Ah. This might be it
Change the line in your update to
$gambar->move('public/uploads/papan', $new_gambar);
Looks like it could be you were using a period instead of a comma.
Please or to participate in this conversation.