Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- <form method="POST">
- <input type="file" name="fileup">
- <input type="submit" name="upload" value="Upload">
- </form> <br>
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $database = "skp";
- $conn = new mysqli($servername, $username, $password, $database);
- if ($conn->connect_error) {
- die("Connection failed" . $conn->connect_error);
- }
- ?>
- <?php
- $sql_select = "SELECT * FROM upload";
- $result = $conn->query($sql_select);
- if ($result->num_rows > 0) {
- while ($row = $result->fetch_assoc()) {
- echo ('');
- ?>
- <form action="filer/<?php echo $row['content']; ?>">
- <input type="submit" value="Se Filen">
- </form>
- <?php
- }
- }
- ?>
- <?php
- if (isset($_POST['upload'])) {
- $sql_insert = "INSERT INTO upload (name,text,content) VALUES ('" . '' . "','". '' . "','" . $_POST['fileup'] . "')";
- if ($conn->query($sql_insert) === TRUE) {
- echo "Filen er uploadet! ";
- } else {
- echo "Fejl";
- }
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement