Reputation: 409
I'm trying to upload images. The uploading working perfectly, but when I'm trying to upload a jpg image it will automatically convert to jpeg. This is my code
if($request->hasFile('image'))
{
if($request->file('image')->store('public/gallery'))
{
$gallery = new Gallery();
$gallery->album_id = $request->album;
$gallery->photo = $request->image->hashName();
$gallery->save();
Session::flash('message','Success:: Image added to gallery');
Session::flash('alert','alert alert-success alert-dismissable');
return back();
}
else
{
Session::flash('message','Warning:: Failed to upload the image');
Session::flash('alert','alert alert-warning alert-dismissable');
return back()->withInput();
}
}
I'm really looking for some help, Thank you
Upvotes: 0
Views: 759
Reputation: 368
Laravel automatically determine file's extension by examining their MIME type. Really there are no difference between jpg and jpeg. See JPG vs. JPEG image formats
Upvotes: 1