I am initializing file upload using the following HTML:
<form enctype="multipart开发者_Go百科/form-data" action="PHPScripts/upload.php" method="POST">
<input type="file" id="browseButton" name="image" onchange="this.form.submit();" />
</form>
Upload.php script looks like this:
<?php
$file = $_FILES["image"];
$filepath = $file["name"];
$filetmp = $file["tmp_name"];
$filesize = $file["size"];
$filename = basename($filepath);
$filetype = substr($filename, strrpos($filename, ".") + 1);
...
?>
I need to pass one more parameter to my php script, but I don't know how. HTTP method is POST (as can be seen in the code above), but where should I put the parameter? Is that even possible? Thanks for clarifying this to me.
Just add another input
element of your choice. No additional magic required.
<input type="hidden" name="info" value="Test">
...
$info = $_POST["info"];
Just put one element inside the same form where the file input is?
精彩评论