Uploading non-images (videos, pdf, …)
-
Using this plugin to upload files other than images (like videos or pdf), files will end up with no extension in the Media Library.
To fix this, change /wp-content/plugins/external-media-upload/index.php
Old:
if( ! isset( $path['extension'] ) ){ $tmpnew = $tmp . '.tmp'; $file_array['tmp_name'] = $tmpnew; } else { $file_array['tmp_name'] = $tmp; } $name = pathinfo( $url, PATHINFO_FILENAME ) . $fileextension;
New:
if( ! isset( $path['extension'] ) ){ $tmpnew = $tmp . '.tmp'; $file_array['tmp_name'] = $tmpnew; } else { $file_array['tmp_name'] = $tmp; } // Use file extension directly from URL if ( empty( $fileextension ) ) { $path = parse_url( $url ); $pathInfo = pathinfo( $path[ 'path' ] ); $fileextension = '.' . $pathInfo[ 'extension' ]; } $name = pathinfo( $url, PATHINFO_FILENAME ) . $fileextension;
- The topic ‘Uploading non-images (videos, pdf, …)’ is closed to new replies.