ShapediveroutputComponent file

Hi,

Im using the ShapediverOutput component to get data from the model and Im able to download correctly the file directly from the browser, but if I try to move the file into a directory of my server, the data inside file is written in a hex format that is not readable to UTF-8.

Not sure where the problem might be, because the same function works with other files.
Here is my function

api.exports.requestAsync({name: “InsoleDataExportDownload”}).then(
function(response)
{
link = response.data.content[0].href;
window.location=link;
}
)

	 window.setInterval(function(){

	    if(link != '')
	    {
	      saveLocalStateData(link,filestate);
	      link = '';
	    }
	}, 10000);

Here Im dowloading the file with export data that is correct formated and im able to read data from inside txt. After 10 seconds Im using the saveLocalStateDate function for store data to my server folder. But when I open data on server, the values are not readable.

saveLocalStateDate()
{
id = _POST[‘id’];
link = _POST[‘link’];
filename = _POST[‘filename’];

if (!is_dir("userfiles/" . $id))
{
    mkdir('userfiles/'.$id, 0777, true);
}

file_put_contents("userfiles/" . $id . "/" . $filename . ".txt", fopen($link, 'r'));

}

Is there a different way to retrive data or the object from the output?

Since the data in the export file is correct (as confirmed by downloading the file locally), the issue is likely a PHP-related one. Probably the right options have to be set in file_put_contents() or the correct headers have to be applied during the transfer. I would suggest getting help from web development/PHP communities.