Giter Site home page Giter Site logo

updrive's Introduction

UpDrive: Allow anyone to upload files to your Google Drive with a simple webform

With a simple webform, hosted on your own webserver, anyone you want can upload files to your Google Drive, in folders you specify. UpDrive is a project written in PHP. It uses the Google API client PHP SDK.

Requirements

Install UpDrive

Install UpDrive and its dependencies with Composer with this command: $ php composer.phar create-project lutsen/updrive [project-name] 0.5
(Replace [project-name] with the desired directory name for your new project)

Rename config_example.php to config.php and add:

  • your server paths
  • the names of the folders people can upload to

Create a Google API project web application

Download the json client secret file from you Google API project, rename it to client_secret.json and add it to the UpDrive root directory.

How to create a Google API project

  1. Go to the Google API Console. Create a new one by selecting Create a new project.
  2. In the sidebar under "API Manager", select Credentials, then select the OAuth consent screen tab. Choose an Email Address, specify a Product Name, and press Save.
  3. In the Credentials tab, select the New credentials drop-down list, and choose OAuth client ID.
  4. Under Application type, select Web application. In the Authorized Redirect URIs field, enter the URL of the oauth2callback.php page.
  5. Press the Create button.
  6. Download the client_secret json file (the download button is on the right).
  7. Rename this file to client_secret.json and add it to the UpDrive root directory.

Use UpDrive

The first time you access UpDrive, you have to connect to the Google account of the Google Drive you want to use. After authorising the UpDrive web application, the OAuth credentials are saved in the credentials.json file. Now people can use the webform to upload files to your Google Drive.

Reconnect UpDrive

To reconnect UpDrive to a Google account, delete the credentials.json file from your webserver and access UpDrive again. Now you can reconnect.

UpDrive project structure

An overview of the directories of a UpDrive and their contents.

public (directory)

Contains the index.php and oauth2callback.php file.

templates (directory)

This directory contains the template files for the setup and form html pages.

vendor (directory)

Created by Composer when installing the project dependencies.

config_example.php (file)

This is an example of the config.php file. The config.php file is needed for UpDrive to work. Rename the config_example.php to config.php and add the necessary details.

init.php (file)

This file includes the config.php and vendor/autoload.php file.
It also sets up the Google_Client object.
The access scope to the Google Drive is defined here to. The UpDrive default is full access. You can find all available access scopes here.

UpDrive is a project of Lútsen Stellingwerff from HoverKraft, and started as a project for Supersolid.

updrive's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

updrive's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.