Hello there!
I wrote the code below to creat multiple file inputs.
Well, it works perfectly, but the file upload does not work and I just want to know if the file fields generated by my function can be used to upload files normally. Because they’re not being uploaded correctly.
[CODE]
inputFilesNumber = 0;
function addRemoveFileInput(elementToBeWritenInId,amountOfFileInputsInputId,toAdd){
amountOfFileInputsInput = document.getElementById(amountOfFileInputsInputId);
elementToBeWritenIn = document.getElementById(elementToBeWritenInId);
if(toAdd){
inputFilesNumber++;
elementToBeWritenIn.innerHTML = elementToBeWritenIn.innerHTML+”<div id=div”+inputFilesNumber+”><input type=’file’ name=’fileInput”+inputFilesNumber+”‘ id=fileInputId”+inputFilesNumber+” ></div>”;
}else{
elementToBeWritenIn.removeChild(document.getElementById(“div”+inputFilesNumber));
inputFilesNumber–;
}
amountOfFileInputsInput.value = inputFilesNumber;
}
You can see this code – as well as an extension verifier function – working in the attached file. You may use it as you please.
[upl-file uuid=8aac5c0d-1f11-4d61-b6fc-3ff5a67247e4 size=1kB]AddRemoveFileInput.zip