How to download a file in react js from an url - javascript

I tried several ways to download a file from URL. Eventhough it is downloading, I couldn't able to view the file. It is showing, the file is not supported

Related

How do I download a File/Blob or data URL from React Native on IOS?

I'm trying to programmatically download a PDF file from the browser, but every time I get an error saying that it was not able to download the file.
I tried to download both Blob and using data URI.
Data URI for example fails saying:
Error: Unable to open URL data:application/pdf... Add data to LSApplicationQueriesSchemes in your info.plist
The code I'm trying to run is an injected JS that tries to download the file.
The code works well in Chrome.

download .cdr files from javascript(react)

Good morning, I have a problem. The service that I am using in my project will return three files in base64 (.pdf, .xml and .cdr). It works fine when I try to download the pdf and xml files, but when I try to download the .cdr files it doesn't download properly. I already search for several types of mime but it doesn't work. Do you know how I can solve it?

Opening an xlsx file from a server directly in excel via url schema

On my server I create an xlsx-file and save it to the servers file system. Afterwards the files URL is sent to the clients browser, where the file is supposed to be opened directly in excel with the help of javascript:
window.location.href = 'ms-excel:ofv|u|https://myserver.com/path/to/file.xlsx'
Now the first time it worked like a charm. The file was downloaded, the browser asked whether to open excel, I said yes and the file was opened in excel.
But as as soon as I try to open the file again or another xlsx file in the same way, it stops working. Excel gives a warning, that it could not access the file.
Does anyone have an idea what the reason could be?
I restarted excel
I looked for cached files that prevent downloading more xlsx files
I checked that the files exist and can be opened (accessed them via their urls directly in the browser)

How to download pdf file using vuejs and bootstrap-vue

I'm trying to upload a pdf file to my browser, but I want to be able to download this file afterwards. I am having problems on the second task - downloading it.
I'm uploading as follow:
<b-form-file v-model="form.file" :state="Boolean(form.file)" placeholder="Choose a file..."></b-form-file>
How can I download form.file content after upload is done?
Edit:
I found this API, which handles file downloads nicely.
You need to save the file somewhere on your server or on a storage service (ie Amazon S3) and then redirect the user to a link where the file itself is served.
The specific implementation is based on your backend implementation and your architectural choices.

Reading remote PDF files with JavaScript

I'm working on an iphone app, that would read pdf files from the folder on web server.
I made the part of app which read PDF files and everthing is fine, now i'm trying to figure out how to load all pdf files from http:/www.blabla.com/pdf, so everytime i upload new pdf, the app would automaticly load it.
Is this possibile, and anybody has ideas how can be done?
This can only be done, by either having Directory Index enabled, or using a server side language such as PHP to read the contents of that folder and output the filenames.

Categories

Resources