I have this code:
$file = Input::file('image');
$destinationPath = base_path().'public/upload/slider/'; // The destination were you store the image.
$filename = $file->getClientOriginalName(); // Original file name that the end user used for it.
$mime_type = $file->getMimeType(); // Gets this example image/png
$extension = $file->getClientOriginalExtension(); // The original extension that the user used example .jpg or .png.
$upload_success = $file->move($destinationPath, $filename); // Now we move the file to its new home.
// This is were you would store the image path in a table
And files name in my upload folder are: public/upload/slider/folder.gif public/upload/slider/footer_left_line.jpg public/upload/slider/phpJtC4Jj public/upload/slider/folder_o.gif public/upload/slider/mail.gif public/upload/slider/post_photo_icon.png What do you think about this problem?
Replace the following line:
$destinationPath = base_path().'public/upload/slider/';
With this:
$destinationPath = 'upload/slider';
It'll upload files in your public/upload/slider
folder. You don't need to use base_path()
and public
in your $destinationPath
.