0% found this document useful (0 votes)
231 views51 pages

Cloudupload

This document provides code samples for uploading a file to Google Cloud Storage using PHP. It involves: 1. Creating a bucket in Cloud Storage to store files 2. Making the bucket public so files can be accessed by third parties 3. Creating a service account, granting it permissions, and downloading its private key file 4. Installing the Google Cloud Storage PHP library via Composer 5. Creating PHP files to handle the configuration, file upload request, and main script 6. Uploading a file to the bucket using the service account's credentials
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
231 views51 pages

Cloudupload

This document provides code samples for uploading a file to Google Cloud Storage using PHP. It involves: 1. Creating a bucket in Cloud Storage to store files 2. Making the bucket public so files can be accessed by third parties 3. Creating a service account, granting it permissions, and downloading its private key file 4. Installing the Google Cloud Storage PHP library via Composer 5. Creating PHP files to handle the configuration, file upload request, and main script 6. Uploading a file to the bucket using the service account's credentials
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 51

' This example requires the Chilkat API to have been previously unlocked.

' See Global Unlock Sample for sample code.

' This example uses a previously obtained access token having permission for the
' scope "https://www.googleapis.com/auth/cloud-platform"

' In this example, Get Google Cloud Storage OAuth2 Access Token,
' the service account access token was saved to a text file. This example fetches the acc
Dim sbToken As New Chilkat.StringBuilder
sbToken.LoadFile("qa_data/tokens/googleCloudStorageAccessToken.txt","utf-8")

' Send a POST equivalent to this curl command.


' The content of the file is contained in the request body.

' curl -X POST --data-binary @[OBJECT] \


' -H "Authorization: Bearer [OAUTH2_TOKEN]" \
' -H "Content-Type: [OBJECT_CONTENT_TYPE]" \
' "https://www.googleapis.com/upload/storage/v1/b/[BUCKET_NAME]/o?uploadType=media&nam

Dim http As New Chilkat.Http


http.AuthToken = sbToken.GetAsString()

Dim sbPath As New Chilkat.StringBuilder


sbPath.Append("/upload/storage/v1/b/bucket_name/o?uploadType=media&name=object_name")
Dim numReplaced As Integer = sbPath.Replace("bucket_name","chilkat-ocean")
numReplaced = sbPath.Replace("object_name","penguins.jpg")

Dim req As New Chilkat.HttpRequest


req.HttpVerb = "POST"
req.Path = sbPath.GetAsString()
req.ContentType = "image/jpeg"
' Indicate the file to be streamed in the request body when the HTTP POST is sent.
req.StreamBodyFromFile("qa_data/jpg/penguins.jpg")

Dim resp As Chilkat.HttpResponse = http.SynchronousRequest("www.googleapis.com",443,True,req)


If (http.LastMethodSuccess = False) Then
Debug.WriteLine(http.LastErrorText)
Exit Sub
End If

Dim responseCode As Integer = resp.StatusCode


If (responseCode = 401) Then
Debug.WriteLine(resp.BodyStr)
Debug.WriteLine("If invalid credentials, then it is likely the access token expired.")
Debug.WriteLine("Your app should automatically fetch a new access token and re-try.")

Exit Sub
End If

Debug.WriteLine("Response code: " & responseCode)


Debug.WriteLine("Response body")
Debug.WriteLine(resp.BodyStr)

' A successful response looks like this:


' Response code: 200
' Response body
' {
' "kind": "storage#object",
' "id": "chilkat-ocean/penguins.jpg/1502643657837855",
' "selfLink": "https://www.googleapis.com/storage/v1/b/chilkat-ocean/o/penguins.jpg",
' "name": "penguins.jpg",
' "bucket": "chilkat-ocean",
' "generation": "1502643657837855",
' "metageneration": "1",
' "contentType": "image/jpeg",
' "timeCreated": "2017-08-13T17:00:57.811Z",
' "updated": "2017-08-13T17:00:57.811Z",
' "storageClass": "MULTI_REGIONAL",
' "timeStorageClassUpdated": "2017-08-13T17:00:57.811Z",
' "size": "777835",
' "md5Hash": "nTd7EM53jEk4s8fixjoimg==",
' "mediaLink": "https://www.googleapis.com/download/storage/v1/b/chilkat-ocean/o/penguins
' "crc32c": "ixxYVw==",
' "etag": "CJ+azOvX1NUCEAE="
' }
sion for the

xample fetches the access token from the file..

o?uploadType=media&name=[OBJECT_NAME]"

me=object_name")

POST is sent.

",443,True,req)

cess token expired.")


token and re-try.")

n/o/penguins.jpg",

ilkat-ocean/o/penguins.jpg?generation=1502643657837855&alt=media",
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
<form id="Form1" method="post" enctype="multipart/form-data" runat="server">
<input type=file id=File1 name=File1 runat="server" />

<input type="submit" id="Submit1" value="Upload" runat="server" NAME="Submit1"/>


</form>
</asp:Content>

If you are able to do it via MVC you could do the following

//Disclaimer -- I should have used the Html helper for this but i was being lazy. /Ajax/AddAttachment is the Controlle

Copy Code

<form method="post" enctype="multipart/form-data" class="asform-inline" action="/Ajax/AddAttachment">


<input type="hidden" name="IssueID" id="IssueID" value="@Model.IndexID
<input type="file" name="files">

<input type="submit" name="submit" value="Add Attachment" class="btn b


</form>

Expand ▼   Copy Code

[HttpPost]
public ActionResult AddAttachment(string IssueID, IEnumerable<HttpPostedFileBase> files)
{
using (UnitOfWork uow = new UnitOfWork())
{
if (files != null)
{
foreach (var file in files)
{
if (file != null)
{
if (file.ContentLength > 0)
{
string fileName = Path.GetFileName(file.FileName);
string path = Path.Combine(Server.MapPath("~/Content/attachments"), fileName);
file.SaveAs(path);
if (System.IO.File.Exists(path))
{
string filename = string.Format(@"{0}{1}", Guid.NewGuid().ToString(), Path
System.IO.File.Move(path, Path.Combine(Server.MapPath("~/Content/attachmen
path = Path.Combine(Server.MapPath("~/Content/attachments"), filename);
}
}
}
}
}
return RedirectToAction("View", "Controller", new { @id = IssueID });
}
}
Submit1"/>

dAttachment is the Controller/method name.

="/Ajax/AddAttachment">
D" value="@Model.IndexID" />

Attachment" class="btn btn-primary" />

se> files)

ttachments"), fileName);
wGuid().ToString(), Path.GetExtension(fileName));
ath("~/Content/attachments"), filename));
chments"), filename);
DROPBOX
ONEDRIVE

Imports Google.Apis.Auth.OAuth2
Imports Google.Apis.Drive.v3
Imports Google.Apis.Drive.v3.Data
Imports Google.Apis.Services
Imports Google.Apis.Util.Store
Imports System.IO
Imports System.Threading

Module Module1
Dim Scopes() As String = {DriveService.Scope.Drive}
Dim ApplicationName As String = "Your-Application-Name"
Private Service As DriveService = New DriveService

Public Sub Main()


Dim creds As UserCredential
'Store your credentials file in the project directory as 'credentials.json'
'Don't forget to include it in your project
Using Stream = New FileStream("credentials.json", FileMode.Open, FileAccess.Read)
'Creates a token file for this auth, make sure to delete it and re-auth
'if you change scopes
Dim credentialFile As String = "token.json"
creds = GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(Stream).Secrets,
Scopes,
"user",
CancellationToken.None,
New FileDataStore(credentialFile, True)).Result
Console.WriteLine("Credentials saved to: " + credentialFile)

End Using
'Create Drive API service.
Dim Service = New DriveService(New BaseClientService.Initializer() With
{
.HttpClientInitializer = creds,
.ApplicationName = ApplicationName
})
'Define parameters of request here, depending on whether you need to use
'the get or export methods
Dim fileId As String = "your-file-id"

'File processing goes here!


End Sub
End Module
     

Upload File To Google Cloud Storage Using PHP


Php
 by Rajesh Kumar Sahanee - January 22, 20200

 Post Views: 7,927
Hello Friends, It’s being very long time and I haven’t shared anything. But today I am going to share how
Step 1: Create Bucket
Step 2: Make Bucket Public
Step 3: Create Service Account & Download Key
Step 4: Install Composer & Download Google Cloud Storage Library
Step 5: Make Code Ready
Step 6: Upload File
Step 1: Create Bucket
First of all we have to create a bucket in which we will upload/store our files. Buckets are the basic conta
Step 2: Make Bucket Public
After creating bucket our next step is to making it public so that we can access it’s object/files at third pa

after saving and making it public

Step 3: Create Service Account & Download Key


Our next step is to create service account and downloading private key so that we can use that private ke
step 1. creating service account

1 gcloud iam service-accounts create [SA-NAME] \


2 &nbsp; &nbsp; --description "[SA-DESCRIPTION]" \
3 &nbsp; &nbsp; --display-name "[SA-DISPLAY-NAME]"
OR
step 2. granting roles to service account

1 gcloud projects add-iam-policy-binding my-project-123 \


2   --member serviceAccount:[email protected] \
3   --role roles/editor
OR

step 3. creating key

1 gcloud iam service-accounts keys create ~/key.json \


2   --iam-account [SA-NAME]@[PROJECT-ID].iam.gserviceaccount.com
OR
Step 4: Install Composer & Download Google Cloud Storage Library
Now in this step we’ll install Composer (Dependency Manager for PHP). After installing composer download Google Cloud

1 composer require google/cloud-storage


Above command will download only google/cloud-storage library because we want to keep our code small as possible so t
Step 5: Make Code Ready
Now our next step is to code. We will create three php files here config.php, requests.php, index.php a
config.php
1 <?php
2
3 // load GCS library
4 require_once 'vendor/autoload.php';
5
6 use Google\Cloud\Storage\StorageClient;
7
8 // Please use your own private key (JSON file content) which was downloaded in step 3 and copy it here
9 // your private key JSON structure should be similar like dummy value below.
10 // WARNING: this is only for QUICK TESTING to verify whether private key is valid (working) or not.  
11 // NOTE: to create private key JSON file: https://console.cloud.google.com/apis/credentials  
12 $privateKeyFileContent = '{
13     "type": "service_account",
14     "project_id": "[PROJECT-ID]",
15     "private_key_id": "[KEY-ID]",
16     "private_key": "-----BEGIN PRIVATE KEY-----\n[PRIVATE-KEY]\n-----END PRIVATE KEY-----\n",
17     "client_email": "[SERVICE-ACCOUNT-EMAIL]",
18     "client_id": "[CLIENT-ID]",
19     "auth_uri": "https://accounts.google.com/o/oauth2/auth",
20     "token_uri": "https://accounts.google.com/o/oauth2/token",
21     "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
22     "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/[SERVICE-ACCOUNT-EMAIL]
23     }';
24
25 /*
26 * NOTE: if the server is a shared hosting by third party company then private key should not be stored as a file,
27 * may be better to encrypt the private key value then store the 'encrypted private key' value as string in database,
28 * so every time before use the private key we can get a user-input (from UI) to get password to decrypt it.
29 */
30
31 function uploadFile($bucketName, $fileContent, $cloudPath) {
32     $privateKeyFileContent = $GLOBALS['privateKeyFileContent'];
33     // connect to Google Cloud Storage using private key as authentication
34     try {
35         $storage = new StorageClient([
36             'keyFile' => json_decode($privateKeyFileContent, true)
37         ]);
38     } catch (Exception $e) {
39         // maybe invalid private key ?
40         print $e;
41         return false;
42     }
43
44     // set which bucket to work in
45     $bucket = $storage->bucket($bucketName);
46
47     // upload/replace file
48     $storageObject = $bucket->upload(
49             $fileContent,
50             ['name' => $cloudPath]
51             // if $cloudPath is existed then will be overwrite without confirmation
52             // NOTE:
53             // a. do not put prefix '/', '/' is a separate folder name  !!
54             // b. private key MUST have 'storage.objects.delete' permission if want to replace file !
55     );
56
57     // is it succeed ?
58     return $storageObject != null;
59 }
60
61 function getFileInfo($bucketName, $cloudPath) {
62     $privateKeyFileContent = $GLOBALS['privateKeyFileContent'];
63     // connect to Google Cloud Storage using private key as authentication
64     try {
65         $storage = new StorageClient([
66             'keyFile' => json_decode($privateKeyFileContent, true)
67         ]);
68     } catch (Exception $e) {
69         // maybe invalid private key ?
70         print $e;
71         return false;
72     }
73
74     // set which bucket to work in
75     $bucket = $storage->bucket($bucketName);
76     $object = $bucket->object($cloudPath);
77     return $object->info();
78 }
79 //this (listFiles) method not used in this example but you may use according to your need
80 function listFiles($bucket, $directory = null) {
81
82     if ($directory == null) {
83         // list all files
84         $objects = $bucket->objects();
85     } else {
86         // list all files within a directory (sub-directory)
87         $options = array('prefix' => $directory);
88         $objects = $bucket->objects($options);
89     }
90
91     foreach ($objects as $object) {
92         print $object->name() . PHP_EOL;
93         // NOTE: if $object->name() ends with '/' then it is a 'folder'
94     }
95 }

requests.php
1 <?php
2 include_once 'config.php';
3
4 $action = filter_var(trim($_REQUEST['action']), FILTER_SANITIZE_STRING);
5 if ($action == 'upload') {
6     $response['code'] = "200";
7     if ($_FILES['file']['error'] != 4) {
8         //set which bucket to work in
9         $bucketName = "cloud-test-bucket-1";
10         // get local file for upload testing
11         $fileContent = file_get_contents($_FILES["file"]["tmp_name"]);
12         // NOTE: if 'folder' or 'tree' is not exist then it will be automatically created !
13         $cloudPath = 'uploads/' . $_FILES["file"]["name"];
14
15         $isSucceed = uploadFile($bucketName, $fileContent, $cloudPath);
16
17         if ($isSucceed == true) {
18             $response['msg'] = 'SUCCESS: to upload ' . $cloudPath . PHP_EOL;
19             // TEST: get object detail (filesize, contentType, updated [date], etc.)
20             $response['data'] = getFileInfo($bucketName, $cloudPath);
21         } else {
22             $response['code'] = "201";
23             $response['msg'] = 'FAILED: to upload ' . $cloudPath . PHP_EOL;
24         }
25     }
26     header("Content-Type:application/json");
27     echo json_encode($response);
28     exit();
29 }

index.php
1 <html>
2     <head>
3         <meta charset="UTF-8">
4         <title>GCP Storage File Upload using PHP</title>
5     </head>
6     <body>
7         <form id="fileUploadForm" method="post" enctype="multipart/form-data">
8             <input type="file" name="file"/>
9             <input type="submit" name="upload" value="Upload"/>
10             <span id="uploadingmsg"></span>
11             <hr/>
12             <strong>Response (JSON)</strong>
13             <pre id="json">json response will be shown here</pre>
14             
15             <hr/>
16             <strong>Public Link</strong> <span>(https://storage.googleapis.com/[BUCKET_NAME]/[OBJECT_NAME])</span><br/>
17             <b>Note:</b> we can use this link only if object or the whole bucket has made public, which in our case has already made buck
18             <div id="output"></div>
19         </form>
20         <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZ
21         <script>
22             $("#fileUploadForm").submit(function (e) {
23                 e.preventDefault();
24                 var action = "requests.php?action=upload";
25                 $("#uploadingmsg").html("Uploading...");
26                 var data = new FormData(e.target);
27                 $.ajax({
28                     type: 'POST',
29                     url: action,
30                     data: data,
31                     /*THIS MUST BE DONE FOR FILE UPLOADING*/
32                     contentType: false,
33                     processData: false,
34                 }).done(function (response) {
35                     $("#uploadingmsg").html("");
36                     $("#json").html(JSON.stringify(response, null, 4));
37                     //https://storage.googleapis.com/[BUCKET_NAME]/[OBJECT_NAME]
38                     $("#output").html('<a href="https://storage.googleapis.com/' + response.data.bucket + '/' + response.data.name + '"><i>https:
39                     if(response.data.contentType === 'image/jpeg' || response.data.contentType === 'image/jpg' || response.data.contentType ===
40                         $("#output").append('<br/><img src="https://storage.googleapis.com/' + response.data.bucket +
41                     }
42                 }).fail(function (data) {
43                     //any message
44                 });
45             });  
46         </script>
47     </body>
48 </html>
Step 6: Upload File

Step 1
Step 2
Step 3
Note: –
Normally we can upload and download any type of file on Google Cloud Storage but if we want to load file using javascript
1. Check current configuration using below command

1 gsutil cors get gs://bucket-name


2. Create json file like below, containg all our domain name

1[
2   {
3     "origin": ["https://zatackcoder.com", "https://zatackcoder.com"],
4     "responseHeader": ["Content-Type"],
5     "method": ["GET"],
6     "maxAgeSeconds": 3600
7   }
8]
3. Change current configuration using below command

1 gsutil cors set corssettingfile.txt gs://bucket-name


Verifying CORS Settings
To verify CORS settings is working or not we’ll just open our website then we open chrome developmen

1 (await fetch('https://storage.googleapis.com/cloud-test-bucket-1/uploads/gull.jpg'))
Before CORS Configuration

After CORS Configuration


NetBeans Project Download
Upload File to Google Cloud Storage using PHP
 1 file(s)  875.14 KB
DOWNLOAD

References:-
https://cloud.google.com/storage/
https://cloud.google.com/storage/docs/key-terms#buckets
https://cloud.google.com/storage/docs/creating-buckets
https://cloud.google.com/cloud-console/
https://cloud.google.com/shell/
https://cloud.google.com/storage/docs/access-control/making-data-public
https://cloud.google.com/iam/docs/service-accounts
https://cloud.google.com/iam/docs/creating-managing-service-account-keys
https://getcomposer.org/
https://googleapis.github.io/google-cloud-php/
https://cloud.google.com/iam/docs/creating-managing-service-accounts
https://cloud.google.com/iam/docs/granting-roles-to-service-accounts
https://cloud.google.com/iam/docs/creating-managing-service-account-keys#iam-service-account-keys-create-gcloud

Thank you Friends


Please don’t forget share if you like it
Tagged Cloud Shell Cloud Storage Bucket Composer GCP Storage Google Cloud Platform Google Cloud Storage gsutil PHP Script to U

Rajesh Kumar Sahanee


I am a passionate Java Developer and I like Computer Programming. I love to do some interesting experiments and listenin
https://www.zatackcoder.com

Post navigation
Previous article
Adding Animations to Controls or Layouts in Android
ext article
ations Built using Java

Comments
Disqus Comments

Facebook Comments

Comments

     

Powered by

Translate
ADVERTISEMENT

RECENT POSTS

Capture Image From Video and Saving to Server in Javascript


Posted on July 14, 20200

Create Dynamic XML Sitemap Using PHP


Posted on July 1, 20200

Sending Message to WhatsApp Number in Android


Posted on June 7, 20200
POPULAR POSTS
 Android Camera 2 Api Example With & Without Preview (20,726)
 Creating Calculator in JavaFX (17,825)
 Convert Number to Indian Currency in PHP (14,437)

 Convert Number to Indian Currency in Java (13,648)


 Keylogger in C/C++ (11,084)

TOP DOWNLOADS

Android Camera 2 Api Example


DOWNLOAD
120548 downloads23.96 MB

Calculator in JavaFX
DOWNLOAD
110370 downloads184.55 KB

Browser
DOWNLOAD
96543 downloads201.60 KB
Image Gallery App Android Studio Project
DOWNLOAD
90126 downloads18.50 MB

Android RecyclerView Swipe to Multiple Options


DOWNLOAD
89594 downloads12.03 MB
ABOUT
This
Blog/Web
site
(ZatackC
oder) is
all about
programm
ing and
you can
find
interestin
g and
useful
Java
program,
Php
programs,
Shell
Script,
Javascript
, turorials,
Hacking
Tricks
and
Tutorial,
etc. You
can also
find and
download
software,
tools,
games
and APIs.
NEWSLETTER
Email
Subscribe
SOCIAL
FacebookYouTube ChannelFeed
ADVERTISEMENT
LATEST POSTS

Capture Image From Video and Saving to Server in Javascript


Posted on July 14, 20200

Create Dynamic XML Sitemap Using PHP


Posted on July 1, 20200

Sending Message to WhatsApp Number in Android


Posted on June 7, 20200

Connect Google App Engine with Google Cloud Storage


Posted on June 6, 20200
am going to share how to upload file to Google Cloud Storage using PHP. With the help of this code we can uploa

kets are the basic containers that hold your data. Everything that you store in Cloud Storage must be contained in a
object/files at third party hosting or at localhost using uri like “https://storage.googleapis.com/[BUCKET_NAM

can use that private key to  connect to Google Cloud Storage. Below screenshot or command will help us to create
r download Google Cloud Storage Library which we are going to use in our code and to download it, we’ll use Terminal (Command Lin

code small as possible so that we can easily upload our code on third party hosting if needed. Composer will download latest stable ve

ests.php, index.php and will upload file through ajax. Here config.php will contain private key and necessary func

ERVICE-ACCOUNT-EMAIL]"
ECT_NAME])</span><br/>
our case has already made bucket public<br/>

tegrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>

sponse.data.name + '"><i>https://storage.googleapis.com/' + response.data.bucket + '/' + response.data.name + '</i></a>');


| response.data.contentType === 'image/png') {
+ response.data.bucket + '/' + response.data.name + '"/>');
o load file using javascript –  XMLHttpRequest (XHR) then by default GCP Storage don’t allow any domain to read file due to CORS polic

en chrome development console and use below ajax fetch command.


nt-keys-create-gcloud

Storage gsutil PHP Script to Upload File to GCP Storage

g experiments and listening music in my free time.


this code we can upload files from third party hosting as well as from localhost (wamp, lamp, xampp, etc) to Goog

must be contained in a bucket. To know more about bucket click buckets link in this paragraph. Below screenshot w
om/[BUCKET_NAME]/[OBJECT_NAME]”. Here also below screenshot will help us to make bucket public or

d will help us to create service account and download private key.


e Terminal (Command Line). In command line we’ll create new directory go inside it or we can go to our project folder if already create

download latest stable version of Google Cloud Storage library after executing above command. After download finishes will have a fo

key and necessary functions, requests.php will use to handle ajax request to upload file and index.php for sending a
read file due to CORS policy, so to solve this problem we need create a configuration file to allow one or more domain to access files u
p, xampp, etc) to Google Cloud Storage. To upload files on Google Cloud Storage we are going to follow below ste

ph. Below screenshot will help us to create bucket from GCP Console or we can execute “gsutil mb gs://[BUCKE
make bucket public or we can make it public using “gsutil acl ch -u AllUsers:R gs://[BUCKET_NAME]/” comm
ject folder if already created then we’ll run below command.

nload finishes will have a folder called ‘vendor’ containing library files, we don’t need to change anything inside it.

ndex.php for sending ajax request and receiving response.


re domain to access files using XHR and to do that we’ll follow below steps:-
ng to follow below steps :-

util mb gs://[BUCKET_NAME]/” command in Cloud Shell.


KET_NAME]/” command also.

You might also like