0

How do i save a file using jquery and html(without any controller).

here is the code:

 $("#tab3_fileaccdoc", r).change(function (e) {
                    var formData = new FormData();
                    //var totalFiles = document.getElementById(e.id).files.length;
                    var file = document.getElementById(e.id).files[0];
                    formData.append("FileUpload", file);
                    $.ajax({
                        type: "POST",
                        url: '/fundprovider/newfundUpload_investmentlogo',
                        data: formData,
                        dataType: 'json',
                        contentType: false,
                        processData: false,
                        success: function (files, data, xhr) {
                            $("#tab3edit_fileaccdoc").val(files);
                            $("#hdnAccountDocument").val(files);
                        },
                        error: function (error) {

                        }
                    });
                })

but with out using controller or anything .. i want to save files directly in a folder using javscript or jquery.

cweiske
  • 30,033
  • 14
  • 133
  • 194
Manoj Maharana
  • 287
  • 1
  • 3
  • 12

1 Answers1

-1

I think this is impossible since saving file to the server's hard drive requires... e-e-m... an application server. Probably you can use some ready-to-use app server for such purposes.

From your example I see that you are actually trying to send file to /fundprovider/newfundUpload_investmentlogo endpoint - which at the end can be a controller. You are clearly messed up with understanding of what a server is. So I suggest you to investigate client-server architecture first.

Illia Ratkevych
  • 3,507
  • 4
  • 29
  • 35
  • Sir I have some html form and I am working on angularjs..So is there any way in html form so that I can save file in a folder...I think there may be any method or functionality in JavaScript or jquery file upload with directly to the folders..So if any thing such like just suggest me. – Manoj Maharana Apr 27 '17 at 15:39
  • What do you mean by "save file in a folder"? Do you want to save file via browser ("Save as" window) on end-user computer? Or you want to save user's file on the server? – Illia Ratkevych Apr 28 '17 at 08:24
  • Check answers on this question http://stackoverflow.com/questions/13405129/javascript-create-and-save-file – Illia Ratkevych May 03 '17 at 09:08