Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am trying to follow the documentation to add form data to JQuery-File-Upload and then process it on my server side php upload handler.

I have added the following to my webpage:

<form id="fileupload" action="/server/php/" method="POST" enctype="multipart/form-data">
<div class="row">
<label>Example: <input type="text" name="example1"></label>
</div>

and then I am trying to use this in my UploadHandler.php file as such:

protected function get_user_path() {
    if ($this->options['user_dirs']) {
        return $this->$POST['example1'].'/';
    }
    return '';
}

With the hope that it will make the upload folder whatever the text written into example1 is. I thought this would work because it states this in the wiki:

e.g. an additional input field with the name attribute example1 will arrive on server-side as POST parameter example1.

and if I replace $POST['example1'] with just 'test' then it does place it in a folder called test.

Help is greatly appreciated.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

you have $POST, it should be $_POST['example1']

share|improve this answer
    
for some reason, it wasn't working when written as $_POST['example1'], but then while fiddling around with it, all I did was change the name to $_POST['name'] which is what I wanted to call the field, and it worked. So yay, your answer was correct! –  Evan Morrison Jan 17 at 7:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.