Advertisement
Guest User

Untitled

a guest
Jan 20th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. <form action="phpscripts/fileupload/imageupload.php" method="post" enctype="multipart/form-data" id="ImageUploadForm">
  2. <div class="filetitle"><input type="text" name="filetitle" id="filetitle" placeholder="Title for Image"></div><br>
  3. <div class="choosefile"><input type="file" name="fileToUpload" id="fileToUpload" accept="image/*"></div>
  4. <div class="filedescription"><textarea name="filedescription" id="filedescription" placeholder="Short Description about the Image"></textarea></div><br /><br>
  5. <div class="uploadbutton"><input type="submit" value="Start Upload" name="submit" id="imagesubmit"></div>
  6. </form>
  7.  
  8. <?php
  9. $server = "localhost";
  10. $username = "databaseuser";
  11. $password = "letmein";
  12. $db = "db_imageupload";
  13.  
  14. $connect = @mysql_connect($server, $username, $password);
  15. ?>
  16.  
  17. <?php if ($connect && mysql_select_db($db, $connect)) : ?>
  18.  
  19. <?php
  20. // Add imagestuff to database
  21. if(isset($_POST['submit'])){
  22. mysql_query("INSERT INTO imageupload (title, imagepath, description) VALUES('".mysql_real_escape_string($_POST['filetitle'])."','".mysql_real_escape_string($imagename.".".$imageFileType)."','".mysql_real_escape_string($_POST['filedescription'])."')") OR die(mysql_error());
  23. }
  24. ?>
  25. <?php else : ?>
  26. <h2>Database connection failed!</h2>
  27. <?php endif; ?>
  28.  
  29. Create Table imageupload(
  30. pk_imageID Integer Primary Key,
  31. title varchar(100),
  32. imagepath varchar(45),
  33. description varchar(300),
  34. time Integer
  35. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement