I’m dying in troubleshooting in this thing. I did it already in the other page, I keep on comparing but I can’t find the problem. It is just a simple image upload…
html
<form action = "image_act.php" method = "post" target = "stud_iframe" >
<label for="file">Filename:</label>
<input type="file" name="images" id="images" required/>
<input type = 'submit' name = 'submit' value = "Submit" />
<br/>
</form>
<iframe class = "stud_frame" name = "stud_iframe" src="image_act.php" style="background-color: #dfdfdf"></iframe>
I recommend using var_dump for debug output, you will get a more insight in to what data you are actually getting and what type it is.
What guido2004 said is also correct. I think you also need the right enctype in your form attributes.
then the result on screen will be “Hello World!”, what happens here is that:
1.) ‘Hello World’ is assigned to $a
2.) content of $a is displayed on screen
The problem in the form is missing enctype which should be:
enctype="multipart/form-data"
For debugging purposes you should use something like this:
Relying on isset($_POST[‘submit’]) used to be prone to failure too, as in some browsers the user hitting the Enter key submits the form but not the submit button value IIRC.
Something like:
if( $_FILES['images']['error'] > 0 ) {
// fail, redirect, exit
}else{
// at least you should actually have a file to handle from here
}