About file download program - Forum

Forum Navigation
You need to log in to create posts and topics.

About file download program

I think it's a basic program, but I don't know, so please tell me.

I want to be able to download a file when I press a button object.

At that time, I want to set the file name to a different Japanese file name instead of the original file name (alphabet).

@bca07313 please check neoDownloadData and neoDownloadURL commands.

https://webhelp.visualneo.com/neoDownload.html

Regards.

fkapnist has reacted to this post.
fkapnist
Thank you for always helping me! I feel like it can be done with neoDownloadData, but I'm having trouble understanding how to use this action and how to create a base64 string.
Where can I find this sample? Or could you please tell me how to do it?
Ultimately, I want the Word file to be downloaded as a Word file with a different name.
fkapnist has reacted to this post.
fkapnist
Quote from bca07313 on March 3, 2023, 1:09 pm
Thank you for always helping me! I feel like it can be done with neoDownloadData, but I'm having trouble understanding how to use this action and how to create a base64 string.
Where can I find this sample? Or could you please tell me how to do it?
Ultimately, I want the Word file to be downloaded as a Word file with a different name.

After downloading the Word file, I think you can simply make a copy of it with a new name, and then delete the original....

.

I asked GPT 3:

Using the "neoDownload" action of VisualNEO Web, how can I download a Word file and set the file name to a different Japanese file name?

It said:

To set a different Japanese file name when downloading a Word file using the "neoDownload" action of VisualNEO Web, you will need to first encode the Japanese file name into a valid URL-encoded string. This can be done using a URL-encoding tool. Once you have the URL-encoded string, you can then use the "neoDownload" action and add the following code: 

&FileName=<URL-encoded string>

For example, if the Japanese file name is "日本語ファイル.docx", the code would be:

&FileName=%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB.docx

.

 

I want the Word file to be downloaded as a Word file with a different name.

@bca07313 Currently there is not any command to convert a remote file into Base64 encoded string, but you can try using JavaScript (not tested):

BeginJS
fetch('https://example.com/remote-file.txt')
  .then(response => response.blob())
  .then(blob => {
    const reader = new FileReader();
    reader.readAsDataURL(blob);
    reader.onloadend = () => {
      const base64data = reader.result.split(',')[1];
      neo.neoDownloadData(base64data,"your-new-file-name.txt","text/plain");
      console.log(base64data);
    }
});
EndJS

@fkapnist note that GPT3 answer has non sense.
Stackoverflow recently banned ChatGPT answers as most of them are not correct.
It's a very powerful tool, but it's necessary to use it wisely.

CDY@44, fkapnist and bca07313 have reacted to this post.
CDY@44fkapnistbca07313
@luishp, @fkapnist, thank you both!
I'll try it with the JavaScript above.
luishp has reacted to this post.
luishp