A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.google.com/appengine/docs/flexible/using-cloud-storage below:

Use Cloud Storage | Google App Engine flexible environment docs

Skip to main content Use Cloud Storage

Stay organized with collections Save and categorize content based on your preferences.

You can use Cloud Storage to store and serve files, such as movies or images or other static content.

This document describes how to use the Cloud Client Libraries for Cloud Storage in your app to store data and retrieve data from Cloud Storage.

Before you begin Download the sample Go

To clone the repository:

git clone https://github.com/GoogleCloudPlatform/golang-samples.git
cd golang-samples/appengine_flexible/storage
Java

To clone the repository:

git clone https://github.com/GoogleCloudPlatform/java-docs-samples
cd java-docs-samples/flexible/java-17/cloudstorage
Node.js

To clone the repository:

git clone https://github.com/GoogleCloudPlatform/nodejs-docs-samples/
cd nodejs-docs-samples/appengine/storage/flexible
PHP

To clone the repository:

git clone https://github.com/GoogleCloudPlatform/php-docs-samples
cd php-docs-samples/appengine/flexible/storage
Python

To clone the repository:

git clone https://github.com/GoogleCloudPlatform/python-docs-samples
cd python-docs-samples/appengine/flexible/storage
Ruby

To clone the repository:

git clone https://github.com/GoogleCloudPlatform/ruby-docs-samples
cd ruby-docs-samples/appengine/flexible/storage/
.NET
  1. Download the sample app and extract it.

  2. If you're using the command line, navigate into the following app directory:

        dotnet-docs-samples\appengine\flexible\CloudStorage\CloudStorage.Sample
    

To run your application locally, set up a service account and download credentials:

  1. Open the list of credentials in the Google Cloud console.

    Open the list of credentials

  2. Click Create credentials.

  3. Select Service account key.

    A Create service account key window opens.

  4. Click the Service account list, and select Compute Engine default service account.

  5. Select JSON for the Key type.

  6. Click Create.

    A New private key window is displayed and the private key for the is downloaded automatically.

  7. Click Close.

    Note: When you create the service account, choose Compute Engine default service account and leave JSON selected under Key Type.
Edit project configuration and install dependencies Go

In app.yaml, set GCLOUD_STORAGE_BUCKET. This value is the name of the Cloud Storage bucket you created previously.

Java

In app.yaml, set the BUCKET_NAME to the Cloud Storage you previously created for your project.

In pom.xml, set com.google.cloud as a dependency, and specify google-cloud-storage as the artifactID for that dependency; this provides the functions to use Cloud Storage.

Node.js

In app.yaml, add your project ID to the GOOGLE_CLOUD_PROJECT environment value. Then set the GCLOUD_STORAGE_BUCKET environment value to the name of the Cloud Storage bucket you created previously.

In package.json, add @google-cloud/storage as a dependency, which provides the functions to use Cloud Storage.

See the README.md file for instructions on running and testing locally.

PHP

In app.yaml, set CLOUD_STORAGE_BUCKET; this value is the name of the Cloud Storage bucket you created previously.

In composer.json, notice that you must include the Cloud Client library, because this provides Cloud Storage functions.

Python

In app.yaml, set GOOGLE_STORAGE_BUCKET; this value is the name of the Cloud Storage bucket you created previously.

In requirements.txt, notice that you must include the google-cloud-storage library, because this provides Cloud Storage functions.

Ruby

In app.yaml, set the GCLOUD_STORAGE_BUCKET to the Cloud Storage you previously created for your project.

Note that you must include the gcloud library in Gemfile to use Cloud Storage functions.

.NET

In app.yaml file , set the TEST_GOOGLE_BUCKET_NAME to the Cloud Storage you previously created for your project.

env_variables:
  TEST_GOOGLE_BUCKET_NAME: [your-bucket-name]
Application code Go

The sample application presents a web page prompting the user to supply a file to be stored in Cloud Storage. When the user selects a file and clicks submit, the upload handler writes the file to the Cloud Storage bucket using Cloud Storage NewWriter function.

Notice that to retrieve this file from Cloud Storage, you will need to specify the bucket name and the filename. You should store these values in your app for future use.

Java

The sample application presents a web page prompting the user to supply a file to be stored in Cloud Storage. When the user selects a file and clicks submit, the doPost request handler writes the file to the Cloud Storage bucket using Storage.create

Notice that to retrieve this file from Cloud Storage, you will need to specify the bucket name and the filename. You should store these values in your app for future use.

Node.js

The sample application presents a web page prompting the user to supply a file to be stored in Cloud Storage. When the user selects a file and clicks submit, the upload handler loads the file content into a blob and writes it to Cloud Storage.

Notice that after the file is uploaded to Cloud Storage, the public URL to this file is returned, which you can use to serve the file directly from Cloud Storage. You should store this value in your app for future use.

PHP

The sample application presents a web page prompting the user to supply a file to be stored in Cloud Storage. When the user selects a file and clicks submit, the upload handler loads the file content into a blob and writes it to Cloud Storage.

Notice that after the file is uploaded to Cloud Storage, the public URL to this file is returned, which you can use to serve the file directly from Cloud Storage. You should store this value in your app for future use.

Python

The sample application presents a web page prompting the user to supply a file to be stored in Cloud Storage. When the user selects a file and clicks submit, the upload handler loads the file content into a Cloud Storage blob and writes it to the Cloud Storage bucket.

Notice that after the file is uploaded to Cloud Storage, the public URL to this file is returned, which you can use to serve the file directly from Cloud Storage. You should store this value in your app for future use.

Ruby

The sample application presents a web page prompting the user to supply a file to be stored in Cloud Storage. When the user selects a file and clicks submit, the upload handler loads the file content into a blob and writes it to Cloud Storage.

Notice that after the file is uploaded to Cloud Storage, the public URL to this file is returned, which you can use to serve the file directly from Cloud Storage. You should store this value in your app for future use.

.NET

The sample application presents a web page prompting the user to supply a file to be stored in Cloud Storage. When the user selects a file and clicks submit, the upload handler loads the file content into a blob and writes it to Cloud Storage.

Notice that after the file is uploaded to Cloud Storage, the public URL to this file is returned, which you can use to serve the file directly from Cloud Storage. You should store this value in your app for future use.

For more information

For complete information on Cloud Storage, see the Cloud Storage documentation.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["This document explains how to use Cloud Storage to store and retrieve files, such as images and other static content, using the Cloud Client Libraries for Cloud Storage."],["Before starting, users need to set up their development environment, create a Cloud Storage bucket, and make it publicly readable."],["Sample code is provided for multiple programming languages, including Go, Java, Node.js, PHP, Python, Ruby, and .NET, with instructions on how to clone the repository and set up dependencies."],["Each language's application code demonstrates how to create a web page for users to upload files, then it uploads the files to a Cloud Storage bucket, and finally it returns a public URL to access the file."],["Users will need to set bucket names in the application configuration, and the instructions walk you through the necessary steps for each language."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4