GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — firebase storage upload from google cloud storage java api · Issue #1484 · googleapis/google-cloud-java

firebase storage upload from google cloud storage java api #1484

New issue
Copy link
New issue
Copy link
Closed
Closed
firebase storage upload from google cloud storage java api#1484
Copy link
Assignees
ucarseyhan

Description

@ucarseyhan
ucarseyhan
opened on Dec 20, 2016
Issue body actions

Hi;

I have a firebase account and I want to upload some photos programmatically to firebase storage. To do this, I am using the google cloud java storage API. I configure the permission and others. I can successfully create buckets, blobs. However, when I tried to upload a picture, either its size is 0 or it cannot downloadable (URL is not generated). The code that I use is below;

		Storage storage = StorageOptions.newBuilder().setProjectId("firebaseId")
					.setCredentials(ServiceAccountCredentials.fromStream(new FileInputStream("jsonFileFor Authentication")))
					.build()
					.getService();
			String blobName = "a.jpg";
			BlobId blobId = BlobId.of(bucket.getName(), blobName);
			InputStream inputStream = new FileInputStream(new File("a.jpg"));
			//BlobInfo blobInfo = BlobInfo.builder(blobId).contentType("image/jpeg").build();
			BlobInfo blobInfo = BlobInfo.builder(bucket.getName(), "a.jpg").contentType("image/jpeg").build();
		try (WriteChannel writer = storage.writer(blobInfo)) {
			byte[] buffer = new byte[1024];
			int limit;
			try {
				while ((limit = inputStream.read(buffer)) >= 0) {
					writer.write(ByteBuffer.wrap(buffer, 0, limit));
				}

			} catch (Exception ex) {
				// handle exception
			}finally {
				writer.close();
			}
		}

Any advice is appreciated. Thanks for the help.

Activity

  1. ucarseyhan commented on Dec 21, 2016

    @ucarseyhan
    ucarseyhan
    on Dec 21, 2016
    Author
    More actions

    Dear All;

    I solve the problem. The problem is related to the configuration of permission on google cloud storage.

    Regards.

  2. ucarseyhan
    closed this as completedon Dec 21, 2016
  3. JustinBeckwith
    assigned
    ucarseyhan
    on Feb 1, 2021
  4. meltsufin
    added a commit that references this issue on Dec 22, 2025

    deps: update dependency com.google.cloud:google-cloud-shared-dependen…

    f3227db
  5. chingor13
    added a commit that references this issue on Jan 6, 2026

    chore(main): release 0.132.10-alpha-SNAPSHOT (#1484)

    e64b094
  6. chingor13
    added a commit that references this issue on Feb 24, 2026

    chore: disable major version updates in renovate config (#1484)

    eb85167
  7. suztomo
    added a commit that references this issue on Mar 11, 2026

    deps: update dependency com.google.cloud:google-cloud-shared-dependen…

    23a9964
  8. chingor13
    added a commit that references this issue on Mar 12, 2026

    chore: disable major version updates in renovate config (#1484)

    d69c4ec
  9. lqiu96
    added a commit that references this issue on Mar 20, 2026

    chore(main): release 0.132.10-alpha-SNAPSHOT (#1484)

    49db56b
  10. suztomo
    added a commit that references this issue on Mar 23, 2026

    chore(main): release 2.15.3 (googleapis#1484)

    1b6b107
  11. suztomo
    added a commit that references this issue on Mar 30, 2026

    deps: update dependency com.google.cloud:sdk-platform-java-config to …

    098c87c
  12. lqiu96
    added a commit that references this issue on Apr 1, 2026

    deps: update dependency com.google.cloud:sdk-platform-java-config to …

    6b6b0f6
  13. meltsufin
    added 4 commits that reference this issue on Apr 29, 2026

    deps: update dependency org.graalvm.buildtools:junit-platform-native …

    8206d12

    chore(main): release 1.123.3 (#1482)

    99652fb

    deps: update dependency org.graalvm.buildtools:junit-platform-native …

    5420496

    chore(main): release 1.123.3 (#1482)

    0acea0e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @ucarseyhan
    ucarseyhan

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.