How to change value of input type file in Jquery : <p>I have got this HTML code</p>

<pre><code>&lt;img src="../img/1.jpg" class="img"&gt;
&lt;img src="../img/2.jpg" class="img"&gt;
&lt;img src="../img/3.jpg" class="img"&gt;
&lt;img src="../img/4.jpg" class="img"&gt;
&lt;input type="file" name="file" id="file" onchange="bgchange(this)" &gt;
</code></pre>

<p>And this jquery</p>

<pre><code>$(".img").click(function(){
                        var srcat=$(this).attr('src');
                        $("#file").attr('value',srcat);
                        alert($("#file").val());
                });
</code></pre>

<p>But it is not changing any value it stays empty.Is there anyway i can change that?</p>
