我正在尝试添加通过Laravel表单上传照片的功能。但是,我似乎有点超出配置它的正常用例。
我的laravel
目录实际上在我的主Web目录之外,对于某些URI,它使用Apache mod_alias
将其重定向到使用Laravel框架。我所有的css,js和图像都存在于主Web目录中,而我所有的laravel文件和目录都存在于其自己的单独目录中。话虽如此,我希望能够将照片上传到的位置是
/html/images/profile-photos
当我的拉拉维尔应用程序存在于
/laravel/...
在我的表单的控制器中,我有
$photo = Input::file('photo');
if ($photo->isValid()) {
$destinationPath = '/html/images/profile-photos/';
$filename = $user->id; //There might be a separate error in not including the file extension here?
$photo->move($destinationPath, $filename);
}
但是当我尝试上传带有表单的图像时,出现错误
Unable to create the "/html/images/profile-photos/" directory
从外观上看,它似乎可能不会进入实际的/html
目录,但可能仍然卡在/laravel
目录中。有没有办法将其存储在预期位置?
道歉。当我发布这个问题时,我意识到我的根目录实际上是后退一步。它必须是
'/root/html/images/profile-pictures'
一旦你说它坏了,它就会自我修复......