Writing a file

I’m having trouble writing a file. When a user inputs text into a text field, I want to save that data in a file for uploading to a server via FTP. However, whenever a user hits the submit button, all old data in the file is overwritten and only the current text is saved in the text file. I need this file to contain a list of all user inputs.

local path = system.pathForFile(“emails.txt”, system.DocumentsDirectory)

local function saveFile()
local file = io.open(path, “w”)

if file then
file:write(textField.text)
else
file = io.open(path, “w”)
file:write(textField.text)
end
io.close(file)
end [import]uid: 186289 topic_id: 35892 reply_id: 335892[/import]

You need to do your open with an “a” for append instead of “w”. Using W will always overwrite your previous file. [import]uid: 34131 topic_id: 35892 reply_id: 142691[/import]

You need to do your open with an “a” for append instead of “w”. Using W will always overwrite your previous file. [import]uid: 34131 topic_id: 35892 reply_id: 142691[/import]

You need to do your open with an “a” for append instead of “w”. Using W will always overwrite your previous file. [import]uid: 34131 topic_id: 35892 reply_id: 142691[/import]

You need to do your open with an “a” for append instead of “w”. Using W will always overwrite your previous file. [import]uid: 34131 topic_id: 35892 reply_id: 142691[/import]