I am creating pdfs and sending them to a directory located in my website files. when these new files are created I want to automatically send them to google drive the user should not have to press any buttons. I have the google drive api set up and working with php using this github example, but do not know what to do next this is the last piece to having my site complete. Thanks for all advice.
Related
I'm developing an web application right now.
What I have so far in the app is this:
<input type="text" id="textToSendToMyGoogleDrive"/>
<button id="upload file to google drive"> Send </button>
This application has a domain, so every one can go to this application from their computer.
What I want to do is when any user put text in the input, and clicks the button, it will make a txt file and send it into my google drive account.
So I have two problems here:
How to take the text and make from it a txt file.
Send the file to specific google drive account.
Problem number 2 is a problem because I have looked every where in the google drive API, and all I could found is some methods to upload files to the user's google drive, and not to mine. So I tried to search out how to "sign in" the user when he is in the application to my google drive, and I could not find a solution.
If I was not clear on the problems, comment me.
Thank you!
I'am not a expert but correct me if I'am wrong. I think there is a problem with your approach. how about sending your text content as a request parameter to the backend and save it as a .txt from there.
I am suggesting this because,
let say you save your file with text content in users computer as described in here.
next step would be to access it from the browser and save it in the google drive. if you planning to do it from the front end without a backend, you have to expose your google credentials to every user.
Before that you wont be able to access a local file from users computer directly from the browser. because most browsers wont allow you to do that. so please change your approach to this.
How can I save api request response directly to google drive ?
Example :
If I pull a csv report from a reporting API, now I need the file to be directly downloaded into my google drive instead of getting downloaded locally onto my system.
You can use the Save to Drive Button.
The Save to Drive button enables your web site to allow users to save
files to their Drive account from an arbitrary URL via their browser.
The button is configured with a few attributes in a div tag in the
HTML markup, similar to how the +1 button is created.
Snippet of code from the documentation:
The simplest way to display a Save to Drive button on your page is to
include the necessary JavaScript resource and to add the Save to Drive
button tag:
<script src="https://apis.google.com/js/platform.js" async defer></script>
<div class="g-savetodrive"
data-src="//example.com/path/to/myfile.pdf"
data-filename="My Statement.pdf"
data-sitename="My Company Name">
</div>
This is how it works:
The technology used to upload files is similar to that used by the
Google Drive web user interface. The file is downloaded to the user's
browser in parts and uploaded to Google Drive as data is received.
This allows the user to save files that require some form of HTTP
authentication because the download is made in the context of the
user's browser.
If the user navigates away from the page before the download is
complete, the data is discarded and no file is created.
I am trying to build an application which will implement following functionalities
It will displays the filenames in my google drive account
Each file has a Delete File button that can delete the file from my google drive account
Page has a Add File button that lets me upload a new file to my google drive account
Each file has a View File button. If the file is a PDF, display the PDF file in the browser using any open js library of your choice. If the file is not a PDF, download the file to the computer.
Please suggest code or any link or api.
It's all possible with Google Drive REST API. It is well documented and there is a lot of guides and wide variety of languages you can use.
I think the most appreciate for you will be JavaScript. Link to JS quickstart
I am trying to integrate box view node js API for box document view.
I have created a node js server. And fetched document and created session and all is working file.
Now when I uploaded some document manually on box.com so it do not fetching documented uploaded manually, It is only showing the list of document which are uploaded programmatically using box view node js API.
Please some one help on this.
Thanks for help in advance.
Sunny K.
I talked to support of box. They told me that files uploaded using box view api and file uploaded from website both are not interconnected. Both are on different places and there is no connection between them.
For using box view api I need to develop some more code for upload document from my own website. And I can fetch these documents only using box view api.
For accessing files uploaded from website. we need to develop application with box content api and box content api do not have any PHP or Node js api right now.
I'm trying to migrate various Excel applications to Google Apps. These generate html and javaScript based on various excel data and parameters to create a local html file which is then opened by a browser.
I know it's a long shot, but can anyone think of a way to mimic this behavior in Google Apps Script? Namely - create a file on the client and fetch it up in a browser session.
Here's an example of the type of application I mean
You can use DocsListApp.createFile to create new HTML files on the user's Google Drive, but I don't believe you can serve the HTML from Drive directly. Alternatively you can use the SitesApp to create a new page on a Google Site with the HTML you want, using Site.addWebPage. Finally, you may want to look into the widgets available in UiApp or the UI Builder, to see if you can use those instead of custom HTML.
Just saw this:
https://googledrive.com/host/0B716ywBKT84AMXBENXlnYmJISlE/GoogleDriveHosting.html
HTML files uploaded to Public Google Drive folder are served as HTML, link is available through "Preview" button.
So far it doesn't work with Google Drive files simply moved to that folder but perhaps would work with files created there via createFile script.