Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

making more genric for multiple fileupload objects on same page. #205

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion js/jquery.uploadfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@

this.fileCounter = 1;
this.selectedFiles = 0;
var formGroup = "ajax-file-upload-" + (new Date().getTime());
var formGroup = "ajax-file-upload-" + (new Date().getTime()) + random_str_gen(9);
this.formGroup = formGroup;
this.errorLog = $("<div></div>"); //Writing errors
this.responses = [];
Expand Down Expand Up @@ -537,6 +537,16 @@
}
}

function random_str_gen(length) {
var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}

function createCustomInputFile (obj, group, s, uploadLabel) {

var fileUploadId = "ajax-upload-id-" + (new Date().getTime());
Expand Down