I am using ckeditor and uploadimage plugin of ckeditor which help me in uploading an image when pasted or dropped on ckeditor. But when I am copying content from word which has some image and paste it on ckeditor it's not uploading that image because it has lot of other stuff other than image. Now After paste I have the path of the image from user's local. Can I upload those files from user's local path using ckeditor or through javascript to my server.?
http://docs.ckeditor.com/#!/guide/dev_file_upload this is the plugin I am talking about.
As Piotr said, Javascript can't read directly a local file or that would be a huge security problem.
The best workaround that I'm aware about pasting images from MS Word is to use the Images From Word plugin that detects those images and prompts the user to upload them by just copying and pasting.
It might not be important to you, but another good thing is that it doesn't require you to change the version of CKEditor as it works with any CKEditor 4.x
No. JavaScript has no access to you local drive.
uploadimage
handle HTML it gets from the browsers and it depends on browser, operation system and, in this case, the version of MS Word. JavaScript get data from the Clipboard API and if local path will be returned instead of real data, and no files, nothing smart can be done.But to be sure you can check what
dataTransfer
contains. It may happen that there is not only HTML but also file you can upload. Add the paste listener:If it contains files you can upload it using fileLoader and, when upload is done, replace the local path with the path to the image on the server.