Quantcast
Channel: Editor — DataTables forums
Viewing all articles
Browse latest Browse all 3812

Datatables Editor File upload with Spring Boot

$
0
0

Hi,

I am trying to support file upload using "Datatables Editor" file upload support to Spring Boot Application.

Following is my Editor config,

var editor = new $.fn.dataTable.Editor( {
    ajax: "/upload1",
    table: "#"+random_str1,
    fields: [ {
        label: "File Title:",
        name: "file_title"
    }, {
        label: "Upload File:",
        name: "flname11",
        type: "upload",
        display: function ( file_id ) {
            return '<img src="'+editor.file( 'files', file_id ).web_path+'"/>';
        },
        clearText: "Clear"
        //noImageText: 'No image'
    }
    ]
 } );

And following is Spring Boot config in Controller,

 @RequestMapping(method = RequestMethod.POST, path = "/upload1",
                  consumes = { MediaType.MULTIPART_FORM_DATA_VALUE },
                  produces = MediaType.APPLICATION_JSON_VALUE)  
   public ResponseEntity<?> handleDataTable_Editor_Request_FileUpload(
    @RequestParam(required = false)  MultipartFile uploadfile, HttpServletRequest request)

   {    
         Note: Here uploadfile is always coming as NULL.
         So i am not getting the file that was uploaded from editor frontend
         wanted to check if any one has solution for this working with Spring Controller

         Actually if i remove "(required = false)" this method is not even called 
                 getting 400 error in browser

   }

and in application.properties have following values,

http.multipart.max-file-size: 128KB 
http.multipart.max-request-size: 128KB
http.multipart.enabled: true
http.multipart.file-size-threshold: 128KB

Can anyone please provide solution or reference here, for getting Datatables editor fileupload working with Spring boot

Thanks


Viewing all articles
Browse latest Browse all 3812

Trending Articles