We Recommend

Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems
Wicked Cool PHP contains a wide variety of scripts to process credit cards, check the validity of email addresses, template HTML, and serve dynamic images and text.


Posted By

tclancy on 04/07/08


Tagged

upload


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

crs0328


PHP File Upload Toggle


Published in: PHP 


Just a quick and dirty way to handle file uploads in admin tools

  1. <div class="formRow">
  2. <label for="related_file">Related File:</label>
  3. <?
  4. if ($oEvent->is_populated("related_file"))
  5. {
  6. echo "<span id=\"replaceFileInfo\">Currently ".$oEvent->get("related_file").". <a href=\"#\" onclick=\"document.getElementById('docUploadBox').style.display='block';document.getElementById('replaceFileInfo').style.display='none';return false;\">Replace?</a></span>";
  7. echo "<span id=\"docUploadBox\" style=\"display: none;\">";
  8. }
  9. else
  10. {
  11. echo "<span id=\"docUploadBox\">";
  12. }
  13. ?>
  14. <input type="file" class="fileUpload" tabindex="9" name="related_file" id="related_file" />
  15. </span>
  16. </div>

Report this snippet 

You need to login to post a comment.