Sir I have these codes

[PHP] <form name="form1" action="<?php $_PHP_SELF ?>" method="post" enctype="multipart/form-data">

  <p><input type="file"  name="file" id="file" value="<?php echo $myphoto; ?>"></p>
  <p><input type="submit" value="photo" name="save"></p>


and these are codes for submit button

            echo $myphoto;
             echo 'Error'; 
     }  [/PHP]

When I press save button the it shows the selected name properly,

But it immediately make file input blank like this


Why php echo is not working in this line?

[PHP] <p><input type="file"  name="file" id="file" value="<?php echo $myphoto; ?>"></p>[/PHP]

File name must remain appear after echo.

Please help

You're setting the value of myphoto upon submitting the form. Before the form has been submitted, it has no value.

Oh, sorry. I'm on my phone and it was hard to understand your question. That's just how th bro see file uploaded works. It automatically shows the file name of the file browser for on the local system. You can't populate it with your own string.

Perhaps instead just remove the file input form and replace it with "file name successfully uploaded".

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.