public MediaFile upload(final String mediaName, final File file, final MediaMimeType contentType)
            throws IOException, AppPlatformException {

        final String uri = StringUtils.join(new String[]{
                getUri(),
                mediaName
        }, '/');        
        client.upload(uri, file, contentType.toString());

        final List<MediaFile> mediaFiles = list(client, 0, 25);
        for (final MediaFile mediaFile : mediaFiles) {
            if (StringUtils.equals(mediaFile.getMediaName(), mediaName)) return mediaFile;
        }
        return null;
    }
public MediaFile upload ( final String mediaName , final File file , final MediaMimeType contentType ) throws IOException , AppPlatformException { final String uri = StringUtils . join ( new String [ ] { getUri ( ) , mediaName } , '/' ) ; client . upload ( uri , file , contentType . toString ( ) ) ; final List < MediaFile > mediaFiles = list ( client , 0 , 25 ) ; for ( final MediaFile mediaFile : mediaFiles ) { if ( StringUtils . equals ( mediaFile . getMediaName ( ) , mediaName ) ) return mediaFile ; } return null ; }
Uploads media file.

@param mediaName new name of media file
@param file source file for uploading
@param contentType MIME type of file or <code>null</code>
@return new media file object
@throws IOException unexpected error.
@throws AppPlatformException unexpected exception.