title: How i can retrieve the path for the file that i upload?
body: <p>im developing a cms.</p>
  
  <p>the Table clients contains many fields and one of them is the image caption.</p>
  
  <p>When the user uploads a file(image) the file is stored in a public folder.</p>
  
  <p>The image caption field retrieves the final name of the file and stores it in the table.</p>
  
  <p>The problem is when the user wants to update the information. If the user doesnt want to change the image, when he clicks "update", the image caption field is empty, so the path to the image becomes null and now he just shows(no image).</p>
  
  <p>heres what ive been trying to do:</p>
  
  <p>The HTML Form:</p>
  
  <p></p>
  
  <pre><code>    &lt;p&gt;
          &lt;label for="image_caption"&gt;Image Caption:&lt;/label&gt;
      &lt;input name="image_caption" id="image_caption" type="text" class="formbox" size="60"  disabled="disabled" value="&lt;?php echo htmlentities($row['image_caption']); ?&gt;" /&gt; 
      &lt;/p&gt;                                                                                     
      &lt;p&gt;
          &lt;label for="image"&gt;Insert image:&lt;/label&gt;
          &lt;input type="hidden" name="MAX_FILE_SIZE" value="&lt;?php echo MAX_FILE_SIZE; ?&gt;" /&gt;
          &lt;input type="file" name="image" id="foto" value="&lt;?php echo htmlentities($row['image_caption']); ?&gt;"/&gt; 
      &lt;/p&gt;
      &lt;p&gt;
          &lt;?php 
          if($row['image_caption']!= ""){
          ?&gt;
              &lt;img src="../images/clientes/&lt;?php echo $row['image_caption'];?&gt;" width="194" height="145" title="Imagem cliente" class="floatright"/&gt;
        &lt;?php
          }else{
          ?&gt;
              &lt;img src="../images/sem_imagem.gif" width="194" height="145" title="Imagem não disponível" class="floatright"/&gt;&lt;br /&gt;                                               
          &lt;?php
          }
          ?&gt;
    &lt;/p&gt;        
      &lt;p&gt;
          &lt;input type="submit" name="update" value="Update" /&gt;
          &lt;input name="cliente_id" type="hidden" value="&lt;?php echo $row['codigo']; ?&gt;" /&gt;
      &lt;/p&gt;
  </code></pre>
  
  <p>And now the upload PHP code(ive just inserted the code that i wanted to show u):</p>
  
  <pre><code>    // This checks if the file input is empty, and if it is, insert the value from the table that was previously inserted
  
      if(empty($_FILES['image']['name'])){
  $image_caption = $row['image_caption'];
  
  }else{
  
  $image = str_replace(' ', '_', $_FILES['image']['name']);   
  // move the file to the upload folder and rename it
  move_uploaded_file($_FILES['image']['tmp_name'],UPLOAD_DIR.$foto);  
  $image_caption = $image;
  }   
  </code></pre>