我有这段代码:
$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
我的上传文件夹中的文件名是: 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 你怎么看待这个问题?
答案 0 :(得分:1)
替换以下行:
$destinationPath = base_path().'public/upload/slider/';
有了这个:
$destinationPath = 'upload/slider';
它会在public/upload/slider
文件夹中上传文件。您不需要在base_path()
中使用public
和$destinationPath
。