Skip to content

Binary File Upload using Restlet + Apache Commons FileUpload #1023

Open
@santiagopoli

Description

@santiagopoli

I have a REST API with Restlet 2.3 and need to implement a file-uploading functionality to it.
The problem is that when someone uploads a file using a POST (with a multipart/form-data Content-Type), the file reaches the server with another encoding. To test this, I printed the contents of the original file in a Unix Terminal and then printed it again before parsing the requet with Apache Commons FileUpload (with almost the same code of this example http://restlet.com/technical-resources/restlet-framework/guide/2.2/extensions/fileupload). Both printed contents are very similar, but the original file has less characters, so i assume that my Java server is using the wrong encoding to interpret the file.

The file I sent is a PNG image. With text files the server works perfectly, but when I send photos or any binary file, the problem appears.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions