Search in sources :

Example 1 with FilePart

use of com.ning.http.multipart.FilePart in project new-cloud by xie-summer.

the class AsyncHttpUtils method uploadFile.

public static void uploadFile(String url, Map<String, String> params, File file, String inputName, String fileName, HttpResultCallback callback) {
    try {
        BoundRequestBuilder rb = getDefault().preparePost(url);
        setPostParams(params, rb);
        FilePart part = new FilePart(inputName, fileName, file);
        rb.addBodyPart(part);
        rb.execute(new AsynchHandler(callback));
    } catch (IOException e) {
        DB_LOGGER.error(e, 30);
    }
}
Also used : BoundRequestBuilder(com.ning.http.client.AsyncHttpClient.BoundRequestBuilder) IOException(java.io.IOException) FilePart(com.ning.http.multipart.FilePart)

Aggregations

BoundRequestBuilder (com.ning.http.client.AsyncHttpClient.BoundRequestBuilder)1 FilePart (com.ning.http.multipart.FilePart)1 IOException (java.io.IOException)1