Thanks once again!
Wanted to thank you once again for the SQLite tutorials.
Not sure if you meant it, but this one has no download button. Thought I would let you know in case oversight.
Cheers!
<?php $query="CREATE TABLE IF NOT EXISTS `file`(file_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, filename TEXT, location TEXT)"; ?>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" /> <link rel="stylesheet" type="text/css" href="css/bootstrap.css" /> </head> <body> <nav class="navbar navbar-default"> <div class="container-fluid"> <a class="navbar-brand" href="https://sourcecodester.com">Sourcecodester</a> </div> </nav> <div class="col-md-3"></div> <div class="col-md-6 well"> <h3 class="text-primary">PHP - File Upload in SQLite3</h3> <hr style="border-top:1px dotted #ccc;"/> <div class="col-md-4"> <form method="POST" action="upload.php" enctype="multipart/form-data"> <div class="form-group"> <label>Uploade here</label> <input type="file" name="file" required="required" class="form-control"/> </div> <center><button class="btn btn-primary" name="upload">Upload</button></center> </form> </div> <div class="col-md-8"> <table class="table table-bordered"> <thead class="alert-info"> <tr> <th>File Name</th> <th>Location</th> </tr> </thead> <tbody> <?php require'conn.php'; while($fetch=$query->fetchArray()){ echo"<tr><td>".$fetch['filename']."</td><td>".$fetch['location']."</td></tr>"; } ?> </tbody> </table> </div> </div> </body> </html>
<?php require_once 'conn.php'; $file_name = $_FILES['file']['name']; $file_temp = $_FILES['file']['tmp_name']; $file_size = $_FILES['file']['size']; $location = "uploads/".$file; if($file_size < 5242880){ $query="INSERT INTO `file` (filename, location) VALUES('$file', '$location')"; echo "<script>alert('File uploaded!')</script>"; echo "<script>window.location='index.php'</script>"; } }else{ echo "<script>alert('File too large to upload!')</script>"; echo "<script>window.location='index.php'</script>"; } } ?>