html editor with file upload

Solutions on MaxInterview for html editor with file upload by the best coders in the world

showing results for - "html editor with file upload"
Mohammed
04 May 2017
1// Include the file upload plugin.
2<script src="../js/plugins/file_upload.min.js"></script>
3
4<script>
5  $(function() {
6    $('.selector')
7      .editable({
8        // Add the upload file button in the toolbar buttons list.
9        buttons: ['bold', 'italic', 'uploadFile', 'html'],
10
11        // Set the file upload parameter.
12        fileUploadParam: 'file_param',
13
14        // Set the file upload URL.
15        fileUploadURL: '/upload_file',
16
17        // Additional upload params.
18        fileUploadParams: {id: 'my_editor'}
19      })
20      .on('editable.fileError', function (e, editor, error) {
21        // Custom error message returned from the server.
22        if (error.code == 0) { ... }
23
24        // Bad link.
25        else if (error.code == 1) { ... }
26
27        // No link in upload response.
28        else if (error.code == 2) { ... }
29
30        // Error during file upload.
31        else if (error.code == 3) { ... }
32
33        // Parsing response failed.
34        else if (error.code == 4) { ... }
35
36        // File too text-large.
37        else if (error.code == 5) { ... }
38
39        // Invalid file type.
40        else if (error.code == 6) { ... }
41
42        // File can be uploaded only to same domain in IE 8 and IE 9.
43        else if (error.code == 7) { ... }
44      })
45  });
46</script>