Hi all,
I have the following script:
index.php:
if( isset( $_POST[ "submitAddItem" ] ) ) {
foreach( $_POST as $tag => $val ) {
print( "tag: " . $tag . "<br>val: " . $val . "<br><br>" );
}
print( var_dump($_POST) );
print( "<br>" );
print( "file error: " . $_FILES["picture"]["error"] );
}
include( "form.php" );
and the form file it is calling looks like this
form.php
<html>
<head><title>problem</head>
<body>
<form name="TheForm" action="<?= $_SERVER[ "PHP_SELF" ] ?>" method="post" enctype="multipart/form-data">
<input type="text" name="random" />
<input type="file" name="picture" value="photo" />
<input type="submit" name="submitAddItem" value="Preview" />
</form>
</body>
</html>
The problem is that the file portion is disappearing somewhere in $_POST.
The results for submitting the form and inputting ex. blahblah to the text form looks like this:
tag: random
val: blahblah
tag: submitAddItem
val: Preview
array(2) { ["random"]=> string(6) "blahblah" ["submitAddItem"]=> string(7) "Preview" }
file error: 0
So as you can see the file is not generating any errors, but the contents of "picture" are not getting into the $_POST array.
I am really really confused. This problem is part of my bigger project, but I isolated it this far and just don't get what in these lines is going wrong.