User uploaded file to google drive via javascript?
We had the same problem - and therefore developed a web service for anonymous uploading into the website owner's Google Drive.
See https://driveuploader.com/
You can easily create a reliable upload component, which can be embedded in any website with an iframe code, similarly like YouTube - or used as a part of other applications with a basic JavaScript API with webhooks.
After you create the uploader - embedding is done with the code like:
<iframe src="https://driveuploader.com/upload/{uploader key}/embed/"></iframe>
It runs in all latest web browsers - and supports unlimited file size uploads (tested on files with hundreds of gigabytes, yes GIGABYTES).
Because the component is responsive - it is perfect also for Wordpress or Google Sites websites.
If you need only a basic page where your friends, students, colleagues can securely drop into your Google Drive some (possibly large) files, then this is offered too - and completely for free.
Disclaimer: we are developers of this service.
Jacob Guthrie
Updated on June 09, 2022Comments
-
Jacob Guthrie almost 2 years
I have a web app that I would like the user to be able to add a file from their computer and upload it to my google drive. I have the choose file button working but I'm not sure as to how the function should look to access my google drive account and send the file upon a button click.
<h4>Upload a file:</h4> <div class="form-group"> <input type="file" id="fileInput" name="fileInput"/> </div><br>
I put this inside a infowindow and I'm able to search for and select a file from the user's computer. I really just looking for the JS function to send it to my google drive. Any help would be appreciated.
-
Jacob Guthrie over 8 yearsWould I put the POST request into a function?
-
rmn36 over 8 yearsHere is info on making a post request using AJAX and jQuery. I'd really recommend trying a simple Google Search before asking questions. I found the answer to both of your questions through Google with very minimal effort. w3schools.com/jquery/jquery_ajax_get_post.asp
-
Jamshaid K. over 5 yearsDoes this control support callback? what if I want to log the Id of the uploaded file in my database?
-
MapTiler over 4 yearsYes - JavaScript client side callback is supported, as well as a server side webhook to your own backend.
-
Jamshaid K. over 4 yearsThe reply is kinda late. I ended up using Google Drive api to upload files.