Jump to content

How to echo target path into File box?


dwex

Recommended Posts

To make the content of form fields persist between page requests, you must write the value you receive from a form submission into the value="..." attribute of the form field.

 

If you are referring to a type="file" input field, that field can only be set by the browser's file dialog box and cannot be made to persist between page requests.

<td><label for='images'> <b>File to upload:</b> </label></td>

<td><input type='file'  name = 'drama_image' '<?php echo $row['drama_image']; ?>'/></

              </tr>

 

<?php

$target_path = "images/";

$target_path = $target_path . basename( $_FILES['images']['name']);

 

if(move_uploaded_file($_FILES['images']['tmp_name'], $target_path)) {

  echo "The file ".  basename( $_FILES['images']['name']).

    " has been uploaded";

} else{

  echo $row['drama_image'];

}

 

    ?>

 

['drama_image'] is the name of the file

 

I wanna echo it out in the box of file upload so when I save , the default picture will still be there instead of being overwritten as the box does not have any value in it.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.