Access Files on Android though HTML file input - javascript

I have a app which loads in files and displays them as text. It uses javascript and HTML, the file picker opens but when on a Samsung Galaxy Tab A running 6.0 on a account which is not the "Owner" you are unable to access the local files when using the html file input.
Using the owner account
Using another user account
Is there any way to let a none Owner access locla files though this HTML file picker, I know that if you get athris party file manager it will show up with the onedrive and gallery tabs and you can access the file though that. But I wnat it to work with out having to install another app.

Related

How do I access local PDF files in my Chrome Extension app?

Google Chrome allows you to preview local PDF files in the browser like pictured below:
I am working on an extension that takes whatever PDF is in the browser preview and opens it in my custom editor/markup tool.
I have been successful in loading PDFs from remote URLs because I can just send the remote URL to my server, download it there, and open the PDF in my app using PDFjs.
How can I accomplish the same functionality for local PDF files?
I have looked into possibly using javascript to create a File object from local PDF files but Chrome doesn't allow access to the local file system.
I am hoping to accomplish this functionality by the user just clicking my extension icon, similar to the popular extension, Kami.
you need to add permissions to your extension:
"permissions": ["file://*/*"]
to ensure that you have permissions for local files, use:
chrome.extension.isAllowedFileSchemeAccess
P.S. have a good day and do not use upwork for these type of questions :-D

How to Auto Upload a json file to my github Website

There is a program in my company that generates a JSON file. I created a website (that will be live on github pages) using java script and html that displays the information from this JSON. Now I want others in my company to generate individual JSON files and be able to upload them to this website by clicking a single button. I'm thinking the button they click would generate the JSON (let's say it saves automatically as c:data.json), programmatically open the github pages website and then programmatically upload c:data.json. I do not want the json file to be stored on the website, just uploaded for one time use.
I have done a couple google searches and can only seem to find stuff on how to upload a json file in your code which I am already doing locally. I need a local file to programmatically upload, in order to be used in a github pages website. I'm new to web dev and any help is appreciated :)
OS: Windows 10
developed using: node.js, javascript, html, json, github pages.

Open Files in Browser instead of downloading (including files like .doc, .xls etc)

I am using Java Rest APIs to upload files in my project. Based on the configuration my files either goes into s3 bucket, google drive, one drive or even in local file system (in the same machine where my application is running). During download again I am making an ajax call which returns the file in response with Content Disposition header attachment; and browser downloads the file irrespective of its format. I want an option to view these files in the browser instead of downloading it directly. How can I do that ? (Especially formats like doc,xls etc)
As far as I know, there are no client-side libraries exist that can open .doc, .docs, .xls in browser. There is a way to render render your files using browser is to use Google Documents' Viewer or Microsoft Office 365 viewer via an <iframe>. Using this inside an <iframe> you can open your file in side your browser but can not edit.
Google Documents' Viewer inside <iframe>
<iframe src="http://docs.google.com/gview?url=http://example.com/path/to/your/document.doc&embedded=true"></iframe>
Google Documents' Viewer clickable link <a>
Open your doc file
Microsoft Office 365 viewer <iframe>
<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=http://example.com/path/to/your/document.doc' width='1366px' height='623px' frameborder='0'></iframe>
Browsers don't have any built-in way to view Word docs so unless the user has configured their browser to open it with some plugin (which 99% of the world hasn't done), the browser will prompt them to download the file.
However, if you only need to display the Word Document, but don't need to edit it, you can use Google Documents' Viewer via an to display a remotely hosted .doc/.docx.
<iframe src="http://docs.google.com/gview?url=http://url-of-the-file&embedded=true"></iframe>
you can generate temporary URL for your s3 documents by keeping them private.
if you are interested in giving users privilege to edit them online then you can go with any tool like onlyoffice

How to view local files in web browser by displaying and creating a link to local files stored in your computer in your webApp?

I have created a webapp using JSP,Html and Javascript which currently runs on my localhost using apache webserver. I want to display the files and folders and of a directory in local computer. I also want to create a download link or view link of those so that when anyone click on it it will be viewed in new tab or become downloadable as it happens in any ftp server. I know similar type of question has
been asked but none of them worked for me.
To create the download link I used
Download
this does not work as it is not in my webapp path and download attribute also does not work in internet explorer.
I'm not sure why you are exposing your local drive contents on the web but here's an option:
On the page that should display the files, in java code, list all
folders and files then for each file/folder show a link to some page
(for example "navigateLocalDrive" that sends the path of the clicked
file/folder like this:
Download
Now in that jsp, check if the GET variable is a path for a file or a directory,
if its a file, just send it back in the response, if its a
directory, list all files/folders and do the same as in step 1
Please note:
How I encoded the file path in the href in order to work properly.
The Access permissions for the webserver should allow write/read to that path (I'm already doing it on my Tomcat server on local host with the default setup no change needed)
For your reference, here are some helpers for this task:
How to list contents of a server directory using JSP?
Downloading file from JSP/Java
I am not sure if this is possible. In general the access rights are limited to the src and webContent Folder (for your html coding mentioned above for sure) . This is also reasonable, because you do not want to access or change data on your Computer in general, because after local development you want to deploy your web application to a server.
To make a test copy some file to the webContent and you will be able to download it. Within your Java coding you can use some IO package like java.io.File to navigate over folders and files. However keep in mind, that you will get some exceptions like
java.io.FileNotFoundException: C:\WeatherExports\export.txt (Access is denied)
if you want to access files outside the server.

Skydrive API using file picker to download file not working

I have successfully signed in using JavaScript API and populated my Skydrive files in a separate window. But I can't open Skydrive files to my web application (populate after selected the files then I press open button). Getting following error in error console.
no element found ScenarioQos.mvc:1
I have used old version of wl.js, Now changed wl.js from onedrive.com, So now am download new wl.js replace my workspace after working fine.
Note : Redirecting url same for workspace js and onedrive account apps redirecting url.

Categories

Resources