All images in Media Manager getting type "application/octet-stream"

  • All images when uploaded get mimetype "application/octet-stream" in the media__files table, this causes media_type to always return "application" rather than "image" which is messing up the Thumbnail when using @mediaSingle()

    Any ideas on why it isn't getting the mimetype correctly?

       <div class="jsThumbnailImageWrapper jsSingleThumbnailWrapper">
            <?php if (isset($media->path)): ?>
            <figure data-id="{{ $media->id }}">
    //$media->media_type returns application... so thumbnails never show
                <?php if ($media->media_type === 'image'): ?>
                <img src="{{ Imagy::getThumbnail($media->path, (isset($thumbnailSize) ? $thumbnailSize : 'mediumThumb')) }}" alt="{{ $media->alt_attribute }}"/>
                <?php elseif ($media->media_type === 'video'): ?>
                <video src="{{ $media->path }}"  controls width="320"></video>
                <?php elseif ($media->media_type === 'audio'): ?>
                <audio controls><source src="{{ $media->path }}" type="{{ $media->mimetype }}"></audio>
                <?php else: ?>
                <i class="fa fa-file" style="font-size: 50px;"></i>
                <?php endif; ?>
                <a class="jsRemoveSimpleLink" href="#" data-id="{{ $media->pivot->id }}">
                    <i class="fa fa-times-circle removeIcon"></i>
            <input type="hidden" name="medias_single[{{ $zone }}]" value="{{ $media->id }}">
            <?php else: ?>
            <input type="hidden" name="medias_single[{{ $zone }}]" value="">
            <?php endif; ?>

  • In case anyone else has this issue.

    The problem is that the create method is using getClientMimeType() which aparently is less reliable than getMimeType().

    The problem was detailed here:

    In ElequentFileRepository of the Media Module. I changed the following and I am now getting correct mime types:

    'mimetype' => $file->getClientMimeType()


    'mimetype' => $file->getMimeType(),

    Is this in someone's ability to merge into the build?

  • Global Moderator

    Thanks for figuring this one out.
    Also, i agree that whenever you can you should not rely on client mime provided, so this most definitely should be PR'd into the module.
    Would be cool if you can do PR for this on Github. Or wait until I can get my hands on it :)


  • @armababy Thanks, I will do a PR.

Log in to reply

Looks like your connection to AsgardCms was lost, please wait while we try to reconnect.