Advertisement
Guest User

Untitled

a guest
Dec 12th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. <form action="" method="post" enctype="multipart/form-data">
  2. <div class="tekst">Kies een bestand om te uploaden:</div>
  3. <input type="file" name="fileToUpload" id="fileToUpload" value="bestand" class="inputfile"></br>
  4. <label for="fileToUpload">Kies bestand</label>
  5. <input type="hidden" name="action" value="wpse10500">
  6. <input type="submit" style="position: relative; left: 10px;" value="Uploaden" name="fileToUpload">
  7. </form>
  8. <?php
  9. $path = get_home_path();
  10. if (
  11. isset( $_POST['fileToUpload'])) {
  12. require_once( $path . 'wp-admin/includes/image.php' );
  13. require_once( $path . 'wp-admin/includes/file.php' );
  14. require_once( $path . 'wp-admin/includes/media.php' );
  15.  
  16. $attachment_id = media_handle_upload( 'fileToUpload', 0);
  17.  
  18. if ( is_wp_error( $attachment_id ) ) {
  19. } else {
  20. }
  21.  
  22. } else {
  23. }
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement