我已阅读documentation of Froala editor。并尝试在我的本地服务器上重现此示例。
但是,我无法使其发挥作用。代码与文档相同,但我的文件夹结构如下:
cac/web/
uploads/
upload.php
我不断收到错误。无论我如何改变图像路径。我只是不太了解如何将路径放在我给定的文件夹结构中。
<br />
<b>Warning</b>: move_uploaded_file(/cac/web/uploads/069fc534ceb01b2217e12b72583aff80005cb3e8.png): failed to open stream: No such file or directory in <b>/Applications/XAMPP/xamppfiles/htdocs/cac/web/upload.php</b> on line <b>24</b><br />
<br />
<b>Warning</b>: move_uploaded_file(): Unable to move '/Applications/XAMPP/xamppfiles/temp/phpQJYxaP' to '/cac/web/uploads/069fc534ceb01b2217e12b72583aff80005cb3e8.png' in <b>/Applications/XAMPP/xamppfiles/htdocs/cac/web/upload.php</b> on line <b>24</b><br />
{"link":"/uploads/069fc534ceb01b2217e12b72583aff80005cb3e8.png"}
答案 0 :(得分:0)
将行move_uploaded_file($_FILES["file"]["tmp_name"], "/uploads/" . $name);
更改为move_uploaded_file($_FILES["file"]["tmp_name"], getcwd() . "/uploads/" . $name);
应该可以使其发挥作用。