Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form name="form1" method="post">
- <div class="form-group">
- <label for="exampleFormControlFile1">Select a custom profile picture</label>
- <input type="file" class="form-control-file" name ="f1" >
- <input type ="submit" class="form-control-submit" name="submit1" value="Upload">
- </div>
- </form>
- <?php
- if(isset($_POST["submit1"]))
- {
- $tm=md5(time());
- $fnm=$_FILES["f1"]["name"];
- $dst="./images/".$tm.$fnm;
- $dst1="images/".$tm.$fnm;
- move_uploaded_file($_FILES["f1"]["tmp_name"],$dst);
- $res2=mysqli_query($link,"SELECT * FROM image WHERE uid = $_SESSION[uid]");
- $row2 = mysqli_fetch_array($res2);
- if(empty($row2["image"])){
- mysqli_query($link,"INSERT INTO image values('$_SESSION[uid]','$dst1')");
- }else{
- mysqli_query($link,"UPDATE image SET image= '$dst1' WHERE uid = '$_SESSION[uid]' ");
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement