Need to create csv file in cpanel directory from html table in Javascript code












-2















I can download csv file from html table with the help of the following javascript code;



function downloadCSV(csv, filename) {
var csvFile;
var downloadLink;

// CSV file
csvFile = new Blob([csv], {type: "text/csv"});

// Download link
downloadLink = document.createElement("a");

// File name
downloadLink.download = filename;

// Create a link to the file
downloadLink.href = window.URL.createObjectURL(csvFile);

// Hide download link
downloadLink.style.display = "none";

// Add the link to DOM
document.body.appendChild(downloadLink);

// Click download link
downloadLink.click();
}

function exportTableToCSV(filename) {
var csv = ;
var rows = document.querySelectorAll(".csv");

for (var i = 0; i < rows.length; i++) {
var row = ;

cols = rows[i].querySelectorAll(".csvs");
// cols = cols.replace(",","");

for (var j = 0; j < cols.length; j++)
row.push(cols[j].innerText.replace(",",""));

csv.push(row.join(","));
}

// Download CSV file //// now need to create file in cpanel dir.
downloadCSV(csv.join("n"), filename);
}


Now need to create csv file in cpanel directory but not download .Kindly change the same code so that I use it with small change of creation of csv file.










share|improve this question

























  • Hello, welcome to stack overflow. Please could you share what you have already tried? We are here to help you with issues, not write code for you.

    – RobFos
    Nov 14 '18 at 6:18











  • I have written code above for downloading csv file now just need to create. I dont have code yet.

    – Ali Malik
    Nov 14 '18 at 6:21











  • Well, people aren't going to code something for you. The best thing to do would be to go away and try it yourself and if you run in to an issue come back and people would be more than willing to help.

    – RobFos
    Nov 14 '18 at 7:29











  • I rather have my doubts that you’ve written that code yourself … If you did, I would assume you’d know that this is client-side JavaScript, and that that can not write any files directly on the server.

    – misorude
    Nov 14 '18 at 8:01











  • @misorude Yes you are right. I just got the code and it works for downloading.. and now I got it that JS not server-side language so it would not upload.. but I got alternative way. thanks

    – Ali Malik
    Nov 14 '18 at 15:29
















-2















I can download csv file from html table with the help of the following javascript code;



function downloadCSV(csv, filename) {
var csvFile;
var downloadLink;

// CSV file
csvFile = new Blob([csv], {type: "text/csv"});

// Download link
downloadLink = document.createElement("a");

// File name
downloadLink.download = filename;

// Create a link to the file
downloadLink.href = window.URL.createObjectURL(csvFile);

// Hide download link
downloadLink.style.display = "none";

// Add the link to DOM
document.body.appendChild(downloadLink);

// Click download link
downloadLink.click();
}

function exportTableToCSV(filename) {
var csv = ;
var rows = document.querySelectorAll(".csv");

for (var i = 0; i < rows.length; i++) {
var row = ;

cols = rows[i].querySelectorAll(".csvs");
// cols = cols.replace(",","");

for (var j = 0; j < cols.length; j++)
row.push(cols[j].innerText.replace(",",""));

csv.push(row.join(","));
}

// Download CSV file //// now need to create file in cpanel dir.
downloadCSV(csv.join("n"), filename);
}


Now need to create csv file in cpanel directory but not download .Kindly change the same code so that I use it with small change of creation of csv file.










share|improve this question

























  • Hello, welcome to stack overflow. Please could you share what you have already tried? We are here to help you with issues, not write code for you.

    – RobFos
    Nov 14 '18 at 6:18











  • I have written code above for downloading csv file now just need to create. I dont have code yet.

    – Ali Malik
    Nov 14 '18 at 6:21











  • Well, people aren't going to code something for you. The best thing to do would be to go away and try it yourself and if you run in to an issue come back and people would be more than willing to help.

    – RobFos
    Nov 14 '18 at 7:29











  • I rather have my doubts that you’ve written that code yourself … If you did, I would assume you’d know that this is client-side JavaScript, and that that can not write any files directly on the server.

    – misorude
    Nov 14 '18 at 8:01











  • @misorude Yes you are right. I just got the code and it works for downloading.. and now I got it that JS not server-side language so it would not upload.. but I got alternative way. thanks

    – Ali Malik
    Nov 14 '18 at 15:29














-2












-2








-2








I can download csv file from html table with the help of the following javascript code;



function downloadCSV(csv, filename) {
var csvFile;
var downloadLink;

// CSV file
csvFile = new Blob([csv], {type: "text/csv"});

// Download link
downloadLink = document.createElement("a");

// File name
downloadLink.download = filename;

// Create a link to the file
downloadLink.href = window.URL.createObjectURL(csvFile);

// Hide download link
downloadLink.style.display = "none";

// Add the link to DOM
document.body.appendChild(downloadLink);

// Click download link
downloadLink.click();
}

function exportTableToCSV(filename) {
var csv = ;
var rows = document.querySelectorAll(".csv");

for (var i = 0; i < rows.length; i++) {
var row = ;

cols = rows[i].querySelectorAll(".csvs");
// cols = cols.replace(",","");

for (var j = 0; j < cols.length; j++)
row.push(cols[j].innerText.replace(",",""));

csv.push(row.join(","));
}

// Download CSV file //// now need to create file in cpanel dir.
downloadCSV(csv.join("n"), filename);
}


Now need to create csv file in cpanel directory but not download .Kindly change the same code so that I use it with small change of creation of csv file.










share|improve this question
















I can download csv file from html table with the help of the following javascript code;



function downloadCSV(csv, filename) {
var csvFile;
var downloadLink;

// CSV file
csvFile = new Blob([csv], {type: "text/csv"});

// Download link
downloadLink = document.createElement("a");

// File name
downloadLink.download = filename;

// Create a link to the file
downloadLink.href = window.URL.createObjectURL(csvFile);

// Hide download link
downloadLink.style.display = "none";

// Add the link to DOM
document.body.appendChild(downloadLink);

// Click download link
downloadLink.click();
}

function exportTableToCSV(filename) {
var csv = ;
var rows = document.querySelectorAll(".csv");

for (var i = 0; i < rows.length; i++) {
var row = ;

cols = rows[i].querySelectorAll(".csvs");
// cols = cols.replace(",","");

for (var j = 0; j < cols.length; j++)
row.push(cols[j].innerText.replace(",",""));

csv.push(row.join(","));
}

// Download CSV file //// now need to create file in cpanel dir.
downloadCSV(csv.join("n"), filename);
}


Now need to create csv file in cpanel directory but not download .Kindly change the same code so that I use it with small change of creation of csv file.







javascript






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 7:48









Sarath Raj

275




275










asked Nov 14 '18 at 6:11









Ali MalikAli Malik

1




1













  • Hello, welcome to stack overflow. Please could you share what you have already tried? We are here to help you with issues, not write code for you.

    – RobFos
    Nov 14 '18 at 6:18











  • I have written code above for downloading csv file now just need to create. I dont have code yet.

    – Ali Malik
    Nov 14 '18 at 6:21











  • Well, people aren't going to code something for you. The best thing to do would be to go away and try it yourself and if you run in to an issue come back and people would be more than willing to help.

    – RobFos
    Nov 14 '18 at 7:29











  • I rather have my doubts that you’ve written that code yourself … If you did, I would assume you’d know that this is client-side JavaScript, and that that can not write any files directly on the server.

    – misorude
    Nov 14 '18 at 8:01











  • @misorude Yes you are right. I just got the code and it works for downloading.. and now I got it that JS not server-side language so it would not upload.. but I got alternative way. thanks

    – Ali Malik
    Nov 14 '18 at 15:29



















  • Hello, welcome to stack overflow. Please could you share what you have already tried? We are here to help you with issues, not write code for you.

    – RobFos
    Nov 14 '18 at 6:18











  • I have written code above for downloading csv file now just need to create. I dont have code yet.

    – Ali Malik
    Nov 14 '18 at 6:21











  • Well, people aren't going to code something for you. The best thing to do would be to go away and try it yourself and if you run in to an issue come back and people would be more than willing to help.

    – RobFos
    Nov 14 '18 at 7:29











  • I rather have my doubts that you’ve written that code yourself … If you did, I would assume you’d know that this is client-side JavaScript, and that that can not write any files directly on the server.

    – misorude
    Nov 14 '18 at 8:01











  • @misorude Yes you are right. I just got the code and it works for downloading.. and now I got it that JS not server-side language so it would not upload.. but I got alternative way. thanks

    – Ali Malik
    Nov 14 '18 at 15:29

















Hello, welcome to stack overflow. Please could you share what you have already tried? We are here to help you with issues, not write code for you.

– RobFos
Nov 14 '18 at 6:18





Hello, welcome to stack overflow. Please could you share what you have already tried? We are here to help you with issues, not write code for you.

– RobFos
Nov 14 '18 at 6:18













I have written code above for downloading csv file now just need to create. I dont have code yet.

– Ali Malik
Nov 14 '18 at 6:21





I have written code above for downloading csv file now just need to create. I dont have code yet.

– Ali Malik
Nov 14 '18 at 6:21













Well, people aren't going to code something for you. The best thing to do would be to go away and try it yourself and if you run in to an issue come back and people would be more than willing to help.

– RobFos
Nov 14 '18 at 7:29





Well, people aren't going to code something for you. The best thing to do would be to go away and try it yourself and if you run in to an issue come back and people would be more than willing to help.

– RobFos
Nov 14 '18 at 7:29













I rather have my doubts that you’ve written that code yourself … If you did, I would assume you’d know that this is client-side JavaScript, and that that can not write any files directly on the server.

– misorude
Nov 14 '18 at 8:01





I rather have my doubts that you’ve written that code yourself … If you did, I would assume you’d know that this is client-side JavaScript, and that that can not write any files directly on the server.

– misorude
Nov 14 '18 at 8:01













@misorude Yes you are right. I just got the code and it works for downloading.. and now I got it that JS not server-side language so it would not upload.. but I got alternative way. thanks

– Ali Malik
Nov 14 '18 at 15:29





@misorude Yes you are right. I just got the code and it works for downloading.. and now I got it that JS not server-side language so it would not upload.. but I got alternative way. thanks

– Ali Malik
Nov 14 '18 at 15:29












1 Answer
1






active

oldest

votes


















0














JavaScript is a client-side language so it can not perform any function that is concerned with server so need PHP script to do so.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53294126%2fneed-to-create-csv-file-in-cpanel-directory-from-html-table-in-javascript-code%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    JavaScript is a client-side language so it can not perform any function that is concerned with server so need PHP script to do so.






    share|improve this answer




























      0














      JavaScript is a client-side language so it can not perform any function that is concerned with server so need PHP script to do so.






      share|improve this answer


























        0












        0








        0







        JavaScript is a client-side language so it can not perform any function that is concerned with server so need PHP script to do so.






        share|improve this answer













        JavaScript is a client-side language so it can not perform any function that is concerned with server so need PHP script to do so.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 16 '18 at 3:44









        Ali MalikAli Malik

        1




        1






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53294126%2fneed-to-create-csv-file-in-cpanel-directory-from-html-table-in-javascript-code%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Xamarin.iOS Cant Deploy on Iphone

            Glorious Revolution

            Dulmage-Mendelsohn matrix decomposition in Python