It is a project of uploading file to google storage by
-
-html form multipart
-
-angularjs upload directive, controller and $http.post
-
Visit the Google Developer Console
-
Click credentials
-
Create new client ID
-
Create a service account, then generate new JSON key and download the JSON key file. ⋅⋅* Put the JSON key in the root folder, as showed of google_key.json
-
npm install
//index.js replace your keyFilename and projectId
var storage = gcloud.storage({
keyFilename: 'google_key.json',
projectId: 'projectId'
});
- npm start
- localhost:5000/upload
- localhost:5000/angularupload
//result when upload success
{
code: 0,
downloadlink: "https://storage.googleapis.com/bucket/upload.file"
}