views:

16

answers:

1

I've got a website where I want to allow a trusted (;)) user to upload a file. In addition I want to allow the user to place a note with this file.

So:

HTML:

<form name="uploadform" id="uploadform" action="handleRequest.php" enctype="multipart/form-data" method="post">
<input id="note" type="text" value="This File is interesting!"/>
<legend>Choose file to upload</legend>
<input id="userfile" label="userfile" name="file" type="file">
<input value="Upload" onclick="onClickVerify();" type="button">
</form>

Note that there is no submit button, but assume that the JS-function onClickVerify() calls the submit method on the form.

On the PHP side, I can see that my file is transferred as expected, but I can't get to my "note". The $_POST variable is empty and the $_FILES variable only contains the file information.

I've been searching for the answer, but I can't find it. I vaguely recall stumbling across a site that says it can't be done yesterday, but can't seem to find that same information anymore...

Any suggestions?

+1  A: 

This should work:

<input id="note" name="note" type="text" value="This File is interesting!"/>
Alec Smart
Argh, my bad. So deep into the code that I forgot to set the name attribute. Thanks!
Timo