Example usage for org.apache.commons.httpclient.methods.multipart FilePartSource FilePartSource

List of usage examples for org.apache.commons.httpclient.methods.multipart FilePartSource FilePartSource

Introduction

In this page you can find the example usage for org.apache.commons.httpclient.methods.multipart FilePartSource FilePartSource.

Prototype

public FilePartSource(String paramString, File paramFile) throws FileNotFoundException 

Source Link

Usage

From source file:org.safecreative.api.RegisterWork.java

/**
 * @param fileName File name//ww w. j  a v a 2 s  .  c o  m
 * @param workFile File to register
 * @param customValues Work containing register parameters to override those of defined profile,
 * optional if license is defined    
 * @param checksum 
 * @return registration code
 * @throws Exception  
  */
public String registerWork(String fileName, File workFile, Work work, String checksum) throws Exception {
    return registerWork(fileName, new FilePartSource(fileName, workFile), work, checksum);
}

From source file:org.safecreative.api.wrapper.SafeCreativeAPIWrapper.java

/**
 * Uploads a file for register or update a work
 * /* w ww.j ava 2 s  .c om*/
 * @param file file to upload
 * @param fileName filename to use for upload file
 * @param byPost true - upload file using POST, false - upload by API
* @param uploadListener Upload progress listener to notify if not <code>null</code>* 
 * @return upload ticket or null if fails
 * @throws ApiException,FileNotFoundException
 */
public String uploadFile(File file, String fileName, boolean byPost, UploadProgressListener uploadListener)
        throws ApiException, FileNotFoundException {
    return uploadFileSource(new FilePartSource(fileName, file), byPost, uploadListener);
}