php - Froala Editor Image Upload Error

107

I have read the documentation of Froala editor. And tried to reproduce this example at my local server.

But, I cannot make it work. Code is the same as the documentation, but my folder structure is as follows:

cac/web/
    uploads/
    upload.php

I keep getting errors. No matter how I change the image path. I just don't understand too much how should I place the paths with my given folder structure.

<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"}
19

Answer

Solution:

Changing linemove_uploaded_file($_FILES["file"]["tmp_name"], "/uploads/" . $name); tomove_uploaded_file($_FILES["file"]["tmp_name"], getcwd() . "/uploads/" . $name); should get it to work.

People are also looking for solutions to the problem: PHP MySQL statement with multiple variable components

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.