My code for RESTful file upload :
@Path("/upload")
@POST
@Consumes("multipart/form-data")
public String post(
@FormDataParam("part") String s,
@FormDataParam("part") FormDataContentDisposition d) {
return s + ":" + d.getFileName();
}
When I try to upload a file using curl
curl -X POST –form part=@file.txt url
I am getting a HTTP 415-Unsupported Media Type Error. What is wrong ?
After trying a lot of examples finaly find the realy working example on http://iambigd.blogspot.com/2011/06/java-upload-file-using-jersey.html
(need the servlet-api.jar, (apache) commons-oi.jar and (apache) commons-fileupload.jar)