Advertisement
DanielKoehler

Untitled

Nov 18th, 2013
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. <!doctype>
  2. <html>
  3. <head>
  4.     <title>Upload</title>
  5. </head>
  6. <body>
  7. <?php
  8. if(!empty($_FILES)){
  9.     extract($_FILES['myfile']);
  10.     $filename = realpath("./") . "/uploads/" . $name;
  11.     move_uploaded_file($tmp_name, $filename);
  12.     $file = base64_encode(fread(fopen($filename, "r"), filesize($filename)));
  13.     $something_that_could_be_stored_and_retrived_in_the_database = "data:" . $type . ";base64,". $file;
  14.     echo "<image src=\"" . $something_that_could_be_stored_and_retrived_in_the_database . "\">";
  15. } else { ?>
  16.     <fieldset>
  17.         <legend>My upload form</legend>
  18.         <form method="POST" action="./index.php" enctype="multipart/form-data">
  19.             <input type="file" name="myfile">
  20.             <input type="submit" value="Let's get this upload started!">
  21.         </form>
  22.     </fieldset>
  23. <?php } ?>
  24. </body>
  25. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement