Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

guessExtension() return the wrong mp3 file extension #8678

Copy link
Copy link
Closed
@zaherg

Description

@zaherg
Issue body actions

i have this code, which i use in laravel 4 to upload and validate a file ( and they assure to me that this is related to Symfony HttpFoundation laravel/framework#1968 (comment) )

<?php
class HomeController extends BaseController {
    public function getIndex()
    {
        return View::make('hello');
    }
    public function postAddFile(){
        $file = Input::file('pod');
        $files = array('file'=>Input::file('pod') );
        $rules = array('file'=>'required|mimes:mp3');
        echo 'File : '.$file->getClientOriginalName().'<br />';
        echo 'Mime : '. $file->getMimeType().'<br />';
        echo 'Ext : '. $file->guessExtension().'<br />';
        $validate = Validator::make($files,$rules);
        if($validate->passes()){
            echo 'Mime : '. $file->getMimeType().'<br />';
        }else{
            var_dump($validate->messages());
        }
        $file->move(storage_path().'/cache', $file->getClientOriginalName());
    }
}

which am use to validate the file which am uploading ..
but sadly the result is this :

File : test.mp3
Mime : audio/mpeg
Ext : mpga
object(Illuminate\Support\MessageBag)#151 (2) { ["messages":protected]=> array(1) { ["file"]=> array(1) { [0]=> string(37) "The file must be a file of type: mp3." } } ["format":protected]=> string(8) ":message" }

as every one see the validation failed to read the extension of the file, and the result of the $file->guessExtension() is mpga mean while it should be mp3 ..

so am not so sure what is the problem here, and if this is something related to php configuration ..
my server is ubuntu with php 5.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.