Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to retrieve latest pic from PHP
    text
    copied!<p>I am using following code to store images on my webserver:</p> <pre><code>function SavePic() { $allowedExts = array("jpeg", "jpg"); $temp = explode(".", $_FILES["UserPic"]["name"]); $extension = end($temp); if ((($_FILES["UserPic"]["type"] == "image/jpeg") || ($_FILES["UserPic"]["type"] == "image/jpg")) //&amp;&amp; ($_FILES["UserPic"]["size"] &lt; 2097152) &amp;&amp; in_array($extension, $allowedExts)) { if ($_FILES["UserPic"]["error"] &gt; 0) { echo json_encode("Error: ".$_FILES["UserPic"]["error"]); } else { $folder = "/home5/username/public_html/Project/Users/Images/"; echo move_uploaded_file($_FILES["UserPic"]["tmp_name"],$folder.$_REQUEST["email"].".".$extension); } } else { echo json_encode("Invalid file"); } } </code></pre> <p>And Following code to retrieve image:</p> <pre><code>function RetrievePic() { $handle = fopen('php://input','r'); $jsonInput = fgets($handle); // Decoding JSON into an Array $retrieveParameters = json_decode($jsonInput,true); $UserPic = array("UserPic" =&gt; "http://www.mysite.com/Project/Users/Images/".$retrieveParameters['email']."."."jpg"); echo json_encode($UserPic); } </code></pre> <p>For Example if my email is abc@xyz.com then image will be stored as "abc@xyz.com.jpg". The problem is that when I try to overwrite image in order to replace old one with new one, server is returning old one everytime.</p> <p><strong>Update:</strong> When I place url in browser e.g <a href="http://www.mysite.com/Project/Users/Images/abc@xyz.com.jpg" rel="nofollow">http://www.mysite.com/Project/Users/Images/abc@xyz.com.jpg</a> latest image is shown and after that I start receiving latest image.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload