UPLOADIFY plugin does not send MP3

Asked

Viewed 214 times

0

Personal use the plugin UPLOADIFY to send files, but I just discovered that it is not sending when the file has the extension . MP3. If I give a var_dump($_FILES) it comes back empty to me when it is a file. MP3 if I pass for example a PDF o var_dump($_FILES); completed lap?

$(".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);
        }
    });

On the uploadArchive route there is only one var_dump($_FILES).

2 answers

0


The problem was not really in the Plugin, but in the file size limit. I increased the file size from 3 to 20 megas and that’s all right. Thank you

  • I thought about it, but usually PHP sends an error message and crashes the script... weird... - Just a note, I tested yes and with me it worked normally.

0

I don’t know which version you are using, but this is wrong in the latest version (using SWF):

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

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

Download the current version: http://www.uploadify.com/download/

Uploadify™ (Flash version) is in version 3.2.1

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

To free permissions for mp3 files, edit the 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.';
}
  • I am using version 2.1.4 I have no way to change it because the old project is just giving an update on it. I imagine the uploadify.php file is the file uploading file. That’s where my problem is if in the first line of this file I put a var_dump($_files) it returns me empty when the file is mp3.

  • Difficult to support something that is obsolete. It’s probably some problem with uploadify.swf, try to backup your swf and put the swf version 3, open a private window (no cache) and test upload @Joaonivaldo (weak gambiarra kkkkkkk)

  • friend if I migrate to version 3 as you suggested how would my script be updated to the new version? Do you have any changes based on the script I posted at the beginning of the question? Thank you

  • Where did you read in my comment that I told you to migrate everything? I just said to change the swf and not to touch the codes @Joaonivaldo

  • friend I didn’t say you told me to migrate. I said you suggested. And this was your text "Note that Uploadify is in version v3.2.1 and apparently you are using version 2.1.4, I recommend you upgrade.". I’m just trying to follow your suggestion and count on your help. No need to get excited. I’m sorry if I got something wrong.

  • look I made the switch to the new version of Uploadify and the error persists. I put a var_dump($_Files) in the first line of uploadify.php and returns me empty when the file is MP3, if it is another format return the data correctly. The funny thing is that when I choose the file it makes the upload graph to the 100% correctly then ends and returns empty for PHP. You could test there for kindness to see if the problem is only here. Thank you very much

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.