Document uploader: No field associated with document uploader found

I am trying to write a process to create a page with a button for uploading a txt file, and then there is a js function behind that will process the imported data and store them into a database. (e.g. split the text in txt file and store the data as different fields in a table)

I am current trying to log the file content only. I added a js function at the field uploadTXT’s onListSelect.

function dataonSubmit(five, context, result) {
const TXTFileData = context.uploadTXT;
five.log(TXTFileData);

return five.success(result);

}

However, when I import a file, it shows “No field associated with document uploader found”.

May i know what is the correct method to let users import a file from frontend and then process the data in backend and store the processed data in tables?

Thanks.

Hi applemint,

You can refer to this thread here: How to Store Document like Pdf in five?. It will guide you on the correct method for importing documents into Five and reading files.

You can also check out this video that covers the same process:

Thanks for your quick response.

I read the above solution and i think it is about storing documents in db?

May I ask is it possible to not save the imported file in a db table after import?

As the content of the imported file is actually the data i want to inserts into another table, and my goal is to import and process the txt file to create a csv file and store it inside the target table.
Thus actually i dont really need to store the file into the db.

Thanks.

Hi applemint,

Yes, that is possible, what you can do is create a field that has a display type “Memo”.

Attach a function to this field that contains your snippet from above

function dataonSubmit(five, context, result) {
const TXTFileData = context.uploadTXT;
five.log(TXTFileData);


return five.success(result);

}

Then simply just copy and paste the contents from your Txt file into the Memo and then you should be able to read all the data.

Here I copied a Txt file into the Field and was able to log the contents

1 Like