0

I have an input that keeps photos on itself . And I'm using it for a website panel . But when it saves the photo , in editing , I should put a value for it to read the last picture . but it doesn't work well. $_files is empty again ! What can I do for that ?

thanks

<input<?php if(!empty($target_file)) echo ' value="'.$target_file.'"';?> type="file" id="photo" name="photo" class="photo" />

<?php
    $photo= $_FILES['photo'];
    $target_dir = "uploads/";
    srand(time());
    $random_num = (rand()%99999);
    $target_file = $target_dir . $random_num . basename($_FILES["a_photo"]["name"]);
    $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
    move_uploaded_file($_FILES["photo"]["tmp_name"], $target_file);
?>

I hace checked stackoverflow for my answer but didn't find anything .

Majid Sadr
  • 911
  • 7
  • 18

0 Answers0