I have a problem
I have a file type input tag that goest like this:
<input type="file" name="imageupload" id="imageupload" value="<?php $imagefile?>">
I have a PHP file that fetch the file name of the image uploaded in the file input tag and my code goes like this:
//Declare the file input tag
$imagefile = trim($_POST['imageupload']);
echo "$imagefile";
I get an error in this part, the declaration part, it says "Notice: Undefined index: imagefile".
Everything works fine if I select an image but if I don't select an image the error shows up.
I would like to assign a default value to the file input tag let say "default.jpg" if user leave it empty or null. I got the condition like this:
if($_FILES['imageupload']['name'] == "" || if($_FILES['imageupload']['size'] == 0) {
$imagefile = trim("default.jpg");
}
then
echo "$imagefile";
I hope my question is specific enough, Please help and thank you.