Plugin UPLOADIFY does not send MP3

0

Personally I use the UPLOADIFY plugin to send files but I have just discovered that it is not sending when the file has a .MP3 extension. If I give a var_dump ($ _ FILES) it returns empty to me when it is a .MP3 file if I pass for example a PDF var_dump ($ _ FILES); back filled?

$(".upload").uploadify({
        'uploader': '/public/js/Uploadify2.1.4/uploadify.swf',
        'script': '/uploadArquivo',
        'cancelImg': '/public/js/Uploadify2.1.4/cancel.png',
        'fileExt': '*.pdf; *.mp3;*.wav',
        'multi': false,
        'auto': true,
        'width': 120,
        'hideButton': false,
        'buttonText': 'Procurar',
        'rollover': false,
        'sizeLimit': '10485760', //Limitado a 5mb por arquivo. Valores expressos em bytes
        'displayData': 'speed',
        'queueSizeLimit': 1,
        'uploadLimit': 1,
        'onUploadStart': function(file) {
            console.log('=>'+file);
        },
        'onComplete': function(event, queueID, fileObj, response, data) {
            if (response == "erro") {
                alert("Problemas no upload deste audio.");
            } else {
                $("#imgfoto1").attr("src", "<?php echo AUDIO  ?>");
                $("#arquivo").attr("value", response);
            }
        },
        'onError': function(a, b, c, d) {
            if (d.type === "File Size")
                alert("O arquivo " + c.name + " excede o tamanho máximo. \nO Limite é de " + Math.round(d.info / (1024 * 1024)) + "Mb");
            else
                alert("Erro!!! " + d.type + ": " + d.text);
        }
    });

In route uploadFile only has a var_dump ($ _ FILES).

    
asked by anonymous 23.04.2015 / 20:36

2 answers

0

The problem actually was not in the Plugin but rather at the limit of the file size. I increased the file size from 3 to 20 megs and that's fine. Thanks

    
24.04.2015 / 16:01
0

I do not know which version you're using, but this is wrong with the latest version (using SWF):

    'uploader': '/public/js/Uploadify2.1.4/uploadify.swf',
    'script': '/uploadArquivo',
  • uploader: should be the PHP file path
  • 'swf': that should have the swf path

Note that Uploadify is in version v3.2.1 and apparently you are using version 2.1.4, I recommend that you upgrade.

Download current version: link

  

Uploadify ™ (Flash version) is in version 3.2.1

     

UploadiFive ™ (HTML5 version - paid) is in version 1.1.2

To release permissions to mp3 files, edit uploadify.php :

$fileTypes = array('jpg','jpeg','gif','png', 'pdf', 'mp3'); //Adicione MP3 aqui
$fileParts = pathinfo($_FILES['Filedata']['name']);

if (in_array($fileParts['extension'],$fileTypes)) {
    move_uploaded_file($tempFile,$targetFile);
    echo '1';
} else {
    echo 'Invalid file type.';
}
    
23.04.2015 / 20:48