From Sweet Echidna, 5 Years ago, written in Plain Text.
Embed
  1. <html>
  2.  <head>
  3.  <title>A File Upload Script</title>
  4.  </head>
  5.  <body>
  6.  <div>
  7.  <?php
  8.  if ( isset( $_FILES['fupload'] ) ) {
  9.  
  10.      print "name: ".     $_FILES['fupload']['name']       ."<br />";
  11.      print "size: ".     $_FILES['fupload']['size'] ." bytes<br />";
  12.      print "temp name: ".$_FILES['fupload']['tmp_name']   ."<br />";
  13.      print "type: ".     $_FILES['fupload']['type']       ."<br />";
  14.      print "error: ".    $_FILES['fupload']['error']      ."<br />";
  15.  
  16.      if ( $_FILES['fupload']['type'] == "image/gif" ) {
  17.  
  18.          $source = $_FILES['fupload']['tmp_name'];
  19.          $target = "upload/".$_FILES['fupload']['name'];
  20.          move_uploaded_file( $source, $target );// or die ("Couldn't copy");
  21.          $size = getImageSize( $target );
  22.  
  23.          $imgstr = "<p><img width=\"$size[0]\" height=\"$size[1]\" ";
  24.          $imgstr .= "src=\"$target\" alt=\"uploaded image\" /></p>";
  25.  
  26.          print $imgstr;
  27.      }
  28.  }
  29.  ?>
  30.  </div>
  31.  <form enctype="multipart/form-data"
  32.      action="<?php print $_SERVER['PHP_SELF']?>" method="post">
  33.  <p>
  34.  <input type="hidden" name="MAX_FILE_SIZE" value="102400" />
  35.  <input type="file" name="fupload" /><br/>
  36.  <input type="submit" value="upload!" />
  37.  </p>
  38.  </form>
  39.  </body>
  40.  </html>

Replies to Untitled rss

Title Name Language When
Re: Untitled Small Capybara text 5 Years ago.