uploaded file not read properly by javascript
<p>I am uploading an image to be previewed that is being renamed as featured.jpg. The move_uploaded_file is supposed to replace the file if it already exists but when I replace the file with a new one and send the extension to javascript to it can view it. But the javascript is only viewing the picture that was uploaded first even when a new file replaces it.</p>

<p>PHP code:</p>

<pre><code>$directory = "uploads\\".$id."\images\profile_pic\\";       
move_uploaded_file($file_tmp, $directory."featured.".$ext);
</code></pre>

<p>Javascript code:</p>

<pre><code>$.ajaxFileUpload
        (
            {
                url:'upload_pic.php?id='+id,
                secureuri:false,
                fileElementId:'fileToUpload',
                dataType: 'json',
                data:{name:'logan', id:'id'},
                success: function (data, status)
                {
                    if(typeof(data.error) != 'undefined')
                    {
                        if(data.error != '')
                        {
                            alert(data.error);
                        }else
                        {                               $("#crop_preview").append("&lt;br /&gt;&lt;img src=\"uploads\\"+id+"\\images\\profile_pic\\featured."+data.msg+"\" id=\"profile_picture\" alt=\"Profile Preview\" style=\"display:none;\" /&gt;");
                            $('#profile_picture').show();
</code></pre>
