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

Multiple loading returns empty string #26

Open
Tamplier opened this issue May 15, 2013 · 0 comments
Open

Multiple loading returns empty string #26

Tamplier opened this issue May 15, 2013 · 0 comments

Comments

@Tamplier
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant