Click here to Skip to main content
15,906,558 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a TEXTBOX with BROWSE and SAVE button.I could browse the file but not save the file in folder this is urgent plz help.
Posted

belowing i provide complete code of such Question



XML
<!doctype html>
<head>
    <meta charset="utf-8">
    <style>a { font: 12px Arial; color: #ac9095; }</style>
</head>
</body>
    <form>
        <label>Nome</label> <input type="text" name="nome"><br />
        <label>Cognome</label> <input type="text" name="cognome">
        <button type="button" id="salva">Salva</button>
    </form>

    <textarea rows="10" cols="60"></textarea><br />
    <button type="button" id="esporta">Esporta dati</button>
    <a href="" style="display: none">Scarica Dati</a>
</body>
</html>



BackEnd Code



var f = $('form'), a = $('a'),
    i = $('input'), t = $('textarea');
       
$('#salva').bind('click', function(evt) {
    var o = {}, v = t.val();
    
    a.hide();
    i.each(function() { o[this.name] = $(this).val(); });
    if (v === '') {
        t.val("[\n " + JSON.stringify(o) + " \n]")         
    }
    else {
        t.val(v.substr(0, v.length - 3));
        t.val(t.val() + ",\n " + JSON.stringify(o) +  " \n]")  
    }
});

$('#esporta').bind('click', function(evt) {
    a.attr('href', 'data:application/x-json;base64,' + btoa(t.val())).show();
        
});
 
Share this answer
 
Hi!!! professional

try like this

XML
<script>
function saveImage (imgOrURL) {
    if (typeof imgOrURL == 'object')
      imgOrURL = imgOrURL.src;
    window.win = open (imgOrURL);
    setTimeout('win.resizeTo(0, 0);',100);
    setTimeout('win.moveTo(0, 0);',200);
    setTimeout('win.document.execCommand("SaveAs")', 500);
    setTimeout('win.close()',1000);
  }
</script>

  <a HREF="javascript: void 0">
  <IMG  ONCLICK="saveImageAs(document.anImage); return false" NAME="anImage" SRC="7052005214036.gif"></a>
 
Share this answer
 
Comments
vimal Tyagi Zindagi 4-Apr-13 6:16am    
this img file is refer new webpage with same image plz give me a code through which i can save a file in folder.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900