public void performUpload(File uploadedFile, String originalFileName,
String bucket, String key, String mimeType,
ERCloudFilesAttachment attachment) throws MalformedURLException,
IOException {
try {
FilesClient conn = attachment.cloudFilesConnection();
FileInputStream attachmentFileInputStream = new FileInputStream(
uploadedFile);
BufferedInputStream attachmentInputStream = new BufferedInputStream(
attachmentFileInputStream);
try {
try {
conn.storeObjectAs(bucket, uploadedFile, mimeType, key);
URL pathToFile = new URL(conn.getStorageURL() + "/" + bucket + "/" + key);
attachment.setCfPath(pathToFile.toExternalForm());
attachment.setWebPath(pathToFile.getPath());
}
catch (FilesException e) {
throw new IOException("Failed to write '" + bucket + "/"