Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "";
- $password = "";
- $database = "";
- $file_get = $_FILES['foto']['name'];
- $temp = $_FILES['foto']['tmp_name'];
- $conn = mysqli_connect($servername, $username, $password, $database);
- $file_to_saved = "uploads".$file_get;
- move_uploaded_file($temp, $file_to_saved);
- echo $file_to_saved;
- $insert_img = mysqli_query($conn,"INSERT INTO members (avatar) VALUES ('".$file_to_saved."')");
- if ($insert_img) {
- # code...
- echo "Img inserted successfully";
- }
- else{
- echo "There is something wrong with this code.";
- }
- ?>
- <form name="imgupl" action="" method="POST" enctype="multipart/form-data">
- <input type="file" name="foto">
- <p>
- <button>Submit Image</button>
- </form>
Add Comment
Please, Sign In to add comment