Guest User

Untitled

a guest
Feb 13th, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. <div class="container" >
  2. <form action="upload.php" method="POST" enctype="multipart/form-data" style="background-color: #D26969; height: 55%; width: 300px;">
  3. <input type="text" name="Category" placeholder="Category" autocomplete="off" style="width: 185px; height: 40px; padding: 5px; margin-top: 10px; margin-left: 50px; position:relative;" /><br/><br/>
  4. <!--<input type="text" name="img-name" placeholder="File Name" autocomplete="off" style="width: 185px; height: 20px; padding: 5px; margin-top: 10px; margin-left: 50px; position:relative;"/><br/><br/>-->
  5. <input type="text" name="Caption" placeholder="Caption" autocomplete="off" style="width: 185px; height: 40px; padding: 5px; margin-top: 10px; margin-left: 50px; position:relative;"/><br/><br />
  6. <input type="file" name="imgfile" style="width: 185px; margin-left: 50px;" /><br/> <br/>
  7. <input type="submit" name="action" value="Upload" style="margin-left: 170px; height: 30px; padding: 5px; border-radius: 3px; background: #27a465; color: #f7f7f7; border: none;">
  8. </form>
  9. </div>
  10. <div class="container-two">
  11. <ul>
  12. <? php
  13. //code to display the list
  14. ?>
  15. </ul>
  16. </div>
  17.  
  18. include(connect.php);
  19. $Category=$_POST['Category'];
  20. $Caption=$_POST['Caption'];
  21. $File =( $_FILES['imgfile']['name']);
  22. mysqli_query("INSERT INTO images (Category, Caption, Img_dir) VALUES
  23. ('$Category', '$Caption', '$File')") ;
  24.  
  25. <?php
  26.  
  27. $servername = "localhost";
  28. $username = "root";
  29. $password = "";
  30. $database = "schedios";
  31.  
  32. // Create connection
  33. $conn = new mysqli($servername, $username, $password, $database);
  34.  
  35. // Check connection
  36. if ($conn->connect_error) {
  37. die("Connection failed: " . $conn->connect_error);
  38. }
Add Comment
Please, Sign In to add comment