Load file metadata to update

Hello clouders!

I’m trying to make an interface for nextcloud get images from a scanner. I know there are some projects, actually i’m developing forking one.

For now, my issue is, i’m trying to get the file from scanner and write it to nexcloud without two writes. Let explain by steps:
1 - Use exec to turn on the scanner and get the file
2 - Use file class to storage the file in nextcloud.

The logical process I’m doing so far is:
1 - Create file using the class
2 - Get location of that file
3 - Use exec to write the file over the location of nexcloud file.
But after those steps the nextcloud show 0kb, so I need to refresh the data in nexcloud database.

Maybe there are others and betters ways to get the same job done. But so far is what I get.
Thanks for any help.

Ok, maybe other question.

If I upload the file inside nexcloud folder by hand, how can I add it to nextcloud database?

The file will be places near to other files like “nextcloud/data/gerenciador/files/”.