Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top