Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

648
Visualizações
How to save html form data in txt file using javascript

I have a html form. I want to store form data in another txt file using javascript. For ex: I have a html form and store-data.txt file . when user fill the form and hit submit, so data stored in store-data.txt file. How I will do this using javascript.

about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

Javascript can`t save data on server. JS can save data on clients machine. Data on clients machine can be stored using cookie. But I feel, it isnt an aim. Store data from froms can server side apps, driven like php.

about 4 years ago · Juan Pablo Isaza Relatório

0

You can use filesaver.js library for a clean implementation or follow along with this codepen It is the quickest.

about 4 years ago · Juan Pablo Isaza Relatório

0

if you wanted to store input values assign all values in an object then JSON.stringify then throw it to this function to get text file of json

function createTextFile(str){
    var file = new Blob([str])
        anchor = document.createElement("a")
    anchor.href = URL.createObjectURL(file)
    anchor.download = "fileName"
    anchor.click()
    URL.revokeObjectURL(anchor.href)
    anchor.remove()    
}

var input = "this is a string to test"
createTextFile(input)

and if you wanted to save in server side with php there is function in php file-put-contents

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda