Nicedit images upload locally not running

This is how I call the editor:

new nicEditor({ buttonList : ['bold','italic','underline','upload'], iconsPath:'img/nicedit.png', uploadURI : 'http://server.com/integracion/files/nicUpload.php' }).panelInstance(textareaId); 

And the .php file exists (and I'm alone in Docs , and I updated the target paths)

 /* I want them here http://server.com/integracion/files/uploads/ so... */ define('NICUPLOAD_PATH', './uploads'); // Set the path (relative or absolute) to // the directory to save image files define('NICUPLOAD_URI', '/uploads'); // Set the URL (relative or absolute) to // the directory defined above 

But I respond when the download completes (and will generate a warning from nicedit ..)

 <script> try { top.nicUploadButton.statusCb({"error":"Invalid Upload ID"}); } catch(e) { alert(e.message); } </script> 

What am I missing?

-Edit

I think the problem may be in the php file:

 $id = $_POST['APC_UPLOAD_PROGRESS']; /* APC is installed and enabled */ if(empty($id)) { $id = $_GET['id']; } 
+3
source share
2 answers

COMPLETION:

I managed to do this job!

Here is a working example:
http://simplestudio.rs/yard/nicedit/

Uploaded images will be stored here:
http://simplestudio.rs/yard/nicedit/images/

And here is the whole code, just unzip it and put it on your server, basically I needed to configure nicEdit.js because it had some problems.
http://simplestudio.rs/yard/nicedit/nicedit.rar

Just make your code with this js file and, looking at my example, it will work :)

If you have any problems, I will be here to solve this problem.

  • I will not delete this example on my server so that everyone who has this problem can download it freely ...
+19
source

The code responsible for uploading the image is the uploadFile method, it looks for the uploadURI parameter parameter.

You will need to modify the onUploaded event handler to onUploaded your own response instead of imgur ( sample ). By default, it expects at least {"upload": { "links": {"original": "http://..."}, "image": {"width": "123" } }} .

Sorry, but I can not help with FormData () to process the server side with PHP.

For more information, you can try the demo page on the nicEdit website using Firebug or WebInspector to track network requests and of course, the source code.

+2
source

Source: https://habr.com/ru/post/1437466/


All Articles