Multiple loading returns empty string
Hi. I have the problem. I need to upload some files (I don't know how many). And I added inputs dynamically.
'changeListener': function(parent){ if(jVal.attaches < 10) { jVal.attaches++; var att = jVal.attaches; var newElement = $(''); $('#response-form > .attach-form > .attach-inputs').append(newElement); newElement.change(function(){jVal.changeListener(this)}); $(newElement).ajaxfileupload({ 'action': "/index.php?option=com_consulting&task=addAttach&attachID=" + att, 'submit_button': $('#response-form > .attach-form > #sendAttach'), 'params': {'questionID': jVal.requestID}, 'onStart': function() { console.log('starting upload' + att); console.log(this);}, }); } }, And when I try to upload files by pressing #sendAttach button, I get this log messages:
starting upload Object[input#firstattach.custom_inp] starting upload2 Object[input.custom_inp] starting upload3 Object[input.custom_inp] got response: (empty string) Object[input.custom_inp] got response: (empty string) Object[input.custom_inp] got response: logo4w.png 11 attach3
So, only the last file uploaded correctly. This is code to safe files:
$aid = JRequest::getVar('attachID'); $fname = 'attach' . $aid; move_uploaded_file($_FILES[$fname]["tmp_name"], JPATH_SITE.'/upload/' . basename($_FILES[$fname]['name'])); echo $_FILES[$fname]['name'] . " 11 $fname";
What's wrong?