I have a problem figuring this out. How to implement cookie in processing uploaded picture name ?
I have 2 files :
index.php (where you can set your profile picture).
<form action="setPicture.php" method="post" enctype="multipart/form-data" >
Select image to upload:
<input type="file" name="fileToUpload" id="fileToUpload">
<input type="submit" value="Upload Image" name="submit">
setPicture.php
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
} else {
echo "Sorry, there was an error uploading your file.";
}
If a user upload's a profile picture it will be saved in data/img/admin , i must use that source to save it inside the cookie and then get redirected to the main page index.php with the profile picture is set .
Can someone helps me to understand the implementation ?
Here is the complete code of my work. https://jsfiddle.net/u5c4sz6u/1/
Aucun commentaire:
Enregistrer un commentaire