Problem Description:
I have recently created a site in laravel and I had the no issue. But when I uploaded the script in the live server, there was an issue in uploading images.
My form was absolutely fine
<form action="{{route('subject.store')}}" method="POST" enctype="multipart/form-data">
{{csrf_field()}}
<input type="file" name="image">
<button type="submit"> Submit </button>
</form> My controller was absolutely Ok
public function store(Request $request)
{
$post=new Note;
/*image*/$image=$request->file('image');
$new_name=date('y_m_d_h_i_s').'.'.$image->getClientOriginalExtension();
$image->move(public_path('images/posts/'),$new_name);
$post->feature_image=$new_name;
}
$post->save();
}
Same code worked in the localhost and live server got the problem. Others were OK.
[SOLUTION]
the solution was simple in the live server I added this code to my public_html/index.php file after declaring $app and it’s working now.
// set the public path to this directory
$app->bind('path.public', function() {
return __DIR__;
});
STRUCTURE (Submit after Mid Term , 15 Ashad 2083) A) MCQ 1. What is the…
FUNCTION (Assignment) Submit Before Mid Term MCQ 1. What is the output of this statement…
Evolution History of computer Technology (HISTORY OF COMPUTER) Evolution of computer is a study of…
Unit3_ClassMethodDesign_OOAD DOWNLOAD
Maturity of Enterprise Architecture Practice Maturity of Enterprise Architecture Practice DOWNLOAD
Report-on-final-project_Sample_2