Go Back   Site Owners Forums - Webmaster Forums > Web Programming > Programming General > Javascript

Notices


Reply
 
Thread Tools Rate Thread Display Modes
Old 02-07-2015, 12:45 PM   #1
george.web13
Registered User
 
Join Date: Jul 2014
Location: Athens, Greece
Posts: 462
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[i] = {""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 ?
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
george.web13 is offline   Reply With Quote

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:33 AM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.