Question

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 the one in the 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 on response when upload completes (and of corse an alert 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 might be in the php file:

$id = $_POST['APC_UPLOAD_PROGRESS'];  /* APC is installed and enabled */
if(empty($id)) {
    $id = $_GET['id'];
}
Was it helpful?

Solution

FINAL EDIT:

I have managed to make this work!

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

Uploaded images are going to be stored here:
http://simplestudio.rs/yard/nicedit/images/

And here is the whole code, just unpack it and put on your server, mainly I needed to adjust nicEdit.js because it had some issues.
http://simplestudio.rs/yard/nicedit/nicedit.rar

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

If you by any mean have some problems I am here to solve it.

  • I will not delete this example on my server so that everybody who have this issue can freely download it...

OTHER TIPS

The code responsible for image upload is the method uploadFile, it is looking for uploadURI option parameter.

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

I'm sorry but I can't help with the FormData() handling server side with PHP.

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top