I have a HTML form, that contains a bunch of text inputs and one file input. My text inputs pass just fine into my function, however the file doesn’t work the same way. Here’s what I am trying to pass:
$submit = submit_server($_POST['name'], $_POST['ip'], $_FILES['banner'], $_POST['description'], $_POST['slots'], $_POST['tags']);
Here is what the function takes:
submit_server($name, $ip, $banner, $description, $slots, $tags)
Here is my form:
<form action="submit.php" method="POST">
...some text inputs...
<input type="file" name="banner" />
</form>
Is there something I need to change to make this work? Within my function, I check for the file with if(!$banner){ return false; } and it returns false.
I just need to pass the whole file object into my function. Thanks!
all forms that are used for submitting files must have
enctype=”multipart/form-data”
in the form tag, please see manual section: Handling file uploads