0

First of all, I don't use jQueryMobile.
I want to upload an image on a tomcat7 server.
In desktop-app it works fine, but when im going mobile, it will cause an error:

No signature of method: org.springframework.security.web.servletapi.HttpServlet3RequestFactory$Servlet3SecurityContextHolderAwareRequestWrapper.getFile() is applicable for argument types: (java.lang.String) values: [file]

This is my java-code:

// get the file to upload
def uploadFileInput = 'file'
MultipartFile sourceFile = request.getFile(uploadFileInput)

this is my ajax:

$.ajax( {
    url        : createLink( {controller: 'fileManager', action: 'upload', id: Location.params.id, params: {domain: Location.controller, profile: true}} ),
    data       : new FormData( form[0] ),
    cache      : false,
    contentType: false,
    processData: false,
    success    : function( data ) {
        [...]
    },
    error      : function() {
        console.log( 'Upload canceled with errors' )
   }
} );

this is my html:

<form enctype="multipart/form-data">
    <input type="file" name="file" accept="jpg,png,gif" style="display: none">
</form>

Did I forget something?

Mephiztopheles
  • 2,228
  • 1
  • 12
  • 25

0 Answers0