Pass php variable to uploadify

119 views Asked by At

Im trying to pass a php variable to uploadify.php, but it doesn't work.

HTML:

<form>
<input data-no-uniform="true" type="file" name="file_upload" id="file_upload" />
</form>

JS:

<script>
    $('#file_upload').uploadify({
        'method'   : 'POST',
        'formData' : {'product' : <?php echo $product;?>},
        'swf'      : 'misc/uploadify.swf',
        'uploader' : 'misc/uploadify.php',
        'onUploadStart' : function(file){
            $('#file_upload').uploadify('settings','formData',{'product' : <?php echo $product;?>});
        }
    });
</script>

But in the uploadify.php...

if (isset($_POST['product'])) {
        $product = $_POST['product'];
    } else {
        $product = "";
    }

    error_log("PRODUCT: ".$product);

produces...

[24-Nov-2014 22:06:59 Europe/Berlin] PRODUCT:

I don't know, where the error is... :-(

Please Help!

0

There are 0 answers