I have an index.php
and upload.php
. In index.
is a form action="upload.php"
which contains input type="file" id="file" name="file"
Label. The PHP code is:
<?php $file = $_FILES['file']; print_r($file); echo "test"; ?>
For some reason it shows echo
but print_r()
doesn't work.
I tried rewriting the code. Adding additional identifiers for input
tags inside index.php
but still doesn't work. What did i do wrong?
You did not mention the file type being uploaded. Here is an example of image upload. Allows selection of multiple images.
and upload PHP:
To determine the type of image to upload:
You forgot enctype="multipart/form-data"
Try this version