Help with dropzone.zs

I have this problem using dropzone.js for uploading files with drag&drop.

Lets say i have this form:

<form action=""<?php echo $_SERVER['PHP_SELF'];?>"" enctype=""multipart/form-data"" class=""dropzone"" id=""dropzone1"">
<input type=""text"" name=""somevalue"" id=""somevalue"" value=""somevalue"" />
<div class=""fallback"">
<input type=""file"" name=""file-image"" />
</div>
</form>


The javascript for the dropzone call is :
<script type=""text/javascript"">
$(document).ready(function() {

Dropzone.autoDiscover = false;
var fileList = new Array;
var i =0;

$(""#dropzone1"").dropzone({

init: function() {
var $this = this;

$(""#submit-all-1"").click(function() {
$this.processQueue();
});

var totalFiles = 0,completeFiles = 0;
this.on(""addedfile"", function (file) {
totalFiles += 1;
var numQueued=this.getQueuedFiles().length;
});

this.on(""success"", function(file, serverFileName) {
fileList = {""serverFileName"" : serverFileName, ""fileName"" : file.name,""fileId"" : i };
i++;
});

this.on(""removed file"", function (file) {
totalFiles -= 1;
});
this.on(""complete"", function (file) {
completeFiles += 1;
if (completeFiles === totalFiles) {
// Do something
}
});
},
paramName: 'file-image',
acceptedFiles:'image/*',
autoProcessQueue:false,
addRemoveLinks: true,
parallelUploads: 10
});
/////////////////////////////////
});
</script>


And in php section:
<?php
if (!empty($_FILES)) {

$somevalue=$_POST['somevalue'];
$counter=1;

$image=$_FILES['file-image']['name']);
$picture_in = ""/PicsUrl/"".$somevalues.$counter.$image;
move_uploaded_file($_FILES['file-image']['tmp_name'], $picture_in);

$counter++;
}
?>

I want to do this :

With the $somevalue posted, all the files that i upload simultanously,
to be renamed like that:

$somevalue_1_imagefilename
$somevalue_2_imagefilename
$somevalue_3_imagefilename

etc....

Any help ?
 
Back
Top