Search code examples
javafile-uploadweb2py

Sending file from Java to Web2py server


How do you send files from a Java desktop app to a Web2py server? I'm trying to do this below:

StringBuilder mStringBuilder = new StringBuilder();

        for (byte mByte:Files.readAllBytes(mFile.toPath()))
           mStringBuilder.append(mByte);

Then, I send this mStringBuilder.toString() via post to Web2py server.

The problem is that I'm not getting the same file back. I cannot decode my string sent.


Solution

  • I found a solution. It's simple, you have to use MultipartUtilities class in java to send files to web2py server.