Reputation: 277
public function store(Request $request)
{
$request->merge(['slug' => Str::slug($request->baslik), 'user_id' => auth()->user()->id, 'hit' => 0 ]);
$add = Ilan::create($request->post());
$insertedId = $add->id;
if($files=$request->file('images')){
foreach($files as $file){
$photo = new Photo;
$name=rand(0,4000).'-'.Str::slug($request->baslik).'-'.$file->getClientOriginalName();
$file->move(public_path('uploads'),$name);
$photo->ilan_id = $insertedId;
$photo->url = 'uploads/'.$name;
$photo->save();
}
}
return redirect()->route('ilan.index');
}
This is my function. It's working in Local. But when I try it in a server it's not working. Image is not creating and there is no error. Where is the problem, if you help me i will be glad, thank you.
My public folder is: sample.com/references/website
I didnt send public folder to the main folder
Upvotes: 0
Views: 377
Reputation: 168
you public directory named something else
instead of public
inside your hosting that is why you are facing that issue ..
follow that link for solving the issue this link is for laravel 5
for laravel 8 you can check that link
Upvotes: 1