I do requesto to https://api.dropbox.com/1/media/dropbox/{FILE_ID} to retrieve preview URL of a PDF file, then I do GET request on the URL, returned by previous API call, and I receive content-disposition:attachment; filename="{FILE_NAME}" header in the response which forces browser to download a PDF instead of previewing it.
The flow was working fine some time ago and I have been using ?dl=1 to force a download. Did the Dropbox API changed somehow? How do I force preview instead of download?
Related
I am working on React-Native mobile app and I need to handle pdf file coming from the server. The idea is when the user clicks on button, a request to the server is made and a pdf file is returned. My question is how to download and parse this file and show it to the user?
You can do it in app BUT you are going to have a lot of pain, especially with android devices.
My advice is using the Linking api and open a webbrowser:
https://facebook.github.io/react-native/docs/linking
The idea is to check if your url contains a .pdf. You can use a mix of:
https://lodash.com/docs/#includes
https://lodash.com/docs/#filter
https://lodash.com/docs/#split
When you are sure that your url is a pdf, you can use:
Linking.openURL(url);
When I try to view a PDF from an S3 bucket in a WebView, it downloads even though the Content-Type is set to application/pdf and the Content-Disposition to inline (tried without it as well) in the AWS Management Console.
<WebView source={{ uri: this.tosData.link }} />
When getting the URL directly from S3 and pasting into Chrome, it displays as expected, without downloading. If I host the PDF on something like Google Drive, and use that link instead, it also displays as expected. Any thoughts on what could be wrong?
while uploading pdf file into s3 add 'ContentDisposition': "inline" into header, this will help you to view the content instead of downloading.
ALL PDF viewers must in one way or another download a full web page including any referenced content such as a PDF whichever way it is embedded.
A browser may not or does not have to display the PDF since if it was a viral file it would be run without your permission. For that reason hardened browsers will download the pdf and not run the content.
You can add a flag to indicate, you say the pdf may be trusted for inline viewing, if the site page is trusted. that is why there is a setting that on handing ownership dis-position from server to client there are flags download or inline
download only
download and optionally view inline, is preferred by the site, but does not have to be complied with.
Globally PDF viewing is controled by the PDF viewer application and the browsers security settings, such as no window.open or other pop-up.
Is there a way to instantiate a JavaScript video file for upload as if it were a file input?
I need to upload a local server file through the YouTube Upload API using the file's URL (essentially trying to automatically upload files from our server to YouTube on behalf of our clients).
I've attempted to upload the following:
FileToUpload = new File([text], "Trial.mp4", {type: "video/*"});
where text is a array buffer from an xttp request.
However, process always results in "Upload failed: cannot process file".
YouTube API seems to work only with <input type=file/> selector.
Essentially, the following is not possible:
document.getElmentById("myfile").files[0] = FileToUpload;
But YouTube Upload API seemingly will not taking any other form with JavaScript.
I've been searching for over a month now and been unsuccessful. Any help would be greatly appreciated.
I am exporting crytsal report to pdf format and saving the pdf on azure cloud. This code is written in web api. I am also able to download the pdf on client. Is there any way with which I can open this saved pdf file on client side by either using server side code or using jQuery. I just want to keep the file open for the user to view.
Maybe you can have a link point to the PDF file address with response header "response-content-disposition": "inline; filename=this.pdf", "response-content-type": "application/pdf". Then I think the browser will launch proper PDF plugin to show it.
I'm building an app that comunicate with a Web Service and I'm trying to download files from it.
I found that, after sending an appropriate request to the server, if the link of the UIWebView contains "DownloadFolder", that's the correct download link; sending an async request with that url the download works well for files like .pdf .doc .xls and so on..
The problems came when i send a request for a media file like mp3 mov and so. The webview work well and display the player, but I can't get the url from the webview.
I also noticed that in the consolle is displayed a line like this:
setting movie path: http://xxx.xxx.xxx.xxx/WEBSERVER/DownloadFolder/NAMEOFWEBSERVER/ADMIN/FA29-12-2011-12-57-04-163pitorb45sluo0g455wwc3u55.mp3
That's the URL I want to use for the download. How can i get it from code?
Thanks in advance.