I am struggling to understand how to retrieve additional form data when uploading files with Blueimp jQuery File Upload. I am tying to pass a value to be appended to the file name when it is uploaded...
I have an hidden input in my #fileupload form...
<input type="hidden" name="referrer" id="referrer" value="123">
I have added this to my main.js...
$('#fileupload').bind('fileuploadsubmit', function (e, data) {
data.formData = $('form').serializeArray();
});
and this to index.php in the php folder...
$smeg = $_POST['referrer'];
What I now can't work out is how to use the variable $smeg in UploadHander.php
I ideally I would like to add the variable to the file name using the below as an example
protected function trim_file_name($file_path, $name, $size, $type, $error,$index, $content_range) {
return $name. ' - '.$smeg;
}
but whenever I try and use $smeg I get the error $smeg is an undefined variable.
Am I passing the additional form data correctly and if so I do I retrieve it to use if?
$smegis not defined in a scope oftrim_file_name