I want admin to be able to set a max file size from within their dashboard (built in codeigniter)
They have the option to set a setting for 'max file size' as different hosting companies have different upload_max_filesize set in the php.ini files.
i want to pass that variable to dropzone.js
The variable i'm trying to pass is $max_filesize
my dropzone.js code :
Dropzone.options.mydropzone = {
maxFiles: 1,
maxFilesize: '$max_filesize', //where i want to pass the variable
acceptedFiles: ".png, .jpg, .jpeg, .PNG, .JPG, .JPEG",
addRemoveLinks: true,
autoProcessQueue: false,
autoDiscover: false,
clickable: true,
previewsContainer: '#dropzonePreview',
resizeMethod:'crop',
resizeWidth:500,
resizeHeight:500,
resizeQuality: 1.0,
accept: function(file, done) {
console.log("uploaded");
done();
},
error: function(file, msg){
alert(msg);
},
init: function() {
var myDropzone = this;
this.on("addedfile", function(file) {
$("#dropzoneimg").addClass("profile-pic-round")
})
//now we will submit the form when the button is clicked
$("#sbmtbtn").on('click',function(e) {
e.preventDefault();
if (myDropzone.getQueuedFiles().length > 0) {
myDropzone.processQueue();
window.location.href = 'addStaff';
} else {
$("#mydropzone").submit();
}
});
} // init end
};
How is this possible?
EDIT :
Sorry i forgot to mention the dropzone.js is in an external file