تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تتيح لك خدمة Cloud Storage for Firebase تحميل المحتوى الذي ينشئه المستخدمون ومشاركته، مثل الصور والفيديوهات، ما يتيح لك إنشاء محتوى وسائط متعددة تفاعلية في تطبيقاتك. يتم تخزين بياناتك في حزمة Google Cloud Storage، وهي حل لتخزين العناصر بسعة إكسابايت مع توفّر عالٍ وتكرار على مستوى العالم. تتيح لك خدمة "التخزين السحابي في Firebase" تحميل هذه الملفات بأمان مباشرةً من الأجهزة الجوّالة ومتصفّحات الويب، كما تتيح لك التعامل مع الشبكات المتقطّعة بسهولة.
اضبط إعدادات Firebase Security Rules لحزمة التخزين التلقائية. أثناء عملية التطوير، ننصحك بإعداد قواعد الوصول العام.
انقر على تم.
يمكنك الآن عرض الحزمة في علامة التبويب
Cloud Storageالملفات
في وحدة تحكّم Firebase. تنسيق اسم الحزمة التلقائي هو
PROJECT_ID.firebasestorage.app.
إعداد إمكانية الوصول العلني
توفّر خدمة Cloud Storage for Firebase لغة قواعد تعريفية تتيح لك تحديد طريقة تنظيم بياناتك وطريقة فهرسة البيانات وتحديد الوقت الذي يمكن فيه قراءة بياناتك وكتابتها. بشكلٍ تلقائي، يكون الوصول للقراءة والكتابة إلى Cloud Storage محدودًا، وبالتالي لا يمكن إلا للمستخدمين الذين تم إثبات هويتهم قراءة البيانات أو كتابتها. للبدء بدون إعداد Firebase Authentication، يمكنك
ضبط قواعدك للسماح بالوصول العام.
يؤدي ذلك إلى إتاحة Cloud Storage لأي شخص، حتى الأشخاص الذين لا يستخدمون تطبيقك، لذا احرص على إعادة حصر الوصول إلى Cloud Storage عند إعداد المصادقة.
إضافة حزمة تطوير البرامج (SDK) لخدمة Cloud Storage إلى تطبيقك
من جذر مشروع Flutter، شغِّل الأمر التالي لتثبيت المكوّن الإضافي:
flutterpubaddfirebase_storage
بعد الانتهاء، أعِد إنشاء تطبيق Flutter باتّباع الخطوات التالية:
نفِّذ flutterfire configure من دليل مشروع Flutter. يؤدي ذلك إلى تعديل ملف إعداد Firebase (firebase_options.dart) في قاعدة الرموز البرمجية لتطبيقك ليحتوي على اسم حزمة Cloud Storage التلقائية.
يمكنك الوصول إلى حزمة Cloud Storage من خلال إنشاء مثيل من
FirebaseStorage:
finalstorage=FirebaseStorage.instance;// Alternatively, explicitly specify the bucket name URL.// final storage = FirebaseStorage.instanceFor(bucket: "gs://<var>BUCKET_NAME</var>");
استخدام حِزم Cloud Storage مع عدة مستخدمين تمت مصادقتهم في التطبيق نفسه
تكون حالة الاستخدام الأولى مثالية إذا كان لديك مستخدمون في جميع أنحاء العالم، وتريد تخزين بياناتهم بالقرب منهم. على سبيل المثال، يمكنك إنشاء حِزم في الولايات المتحدة وأوروبا وآسيا لتخزين بيانات المستخدمين في هذه المناطق من أجل تقليل وقت الاستجابة.
تكون حالة الاستخدام الثانية مفيدة إذا كانت لديك بيانات بأنماط وصول مختلفة.
على سبيل المثال، يمكنك إعداد حزمة متعددة المناطق أو حزمة إقليمية تخزّن الصور أو المحتوى الآخر الذي يتم الوصول إليه بشكل متكرر، وحزمة Nearline أو Coldline تخزّن نُسخًا احتياطية من بيانات المستخدمين أو المحتوى الآخر الذي يتم الوصول إليه بشكل غير متكرر.
تكون حالة الاستخدام الثالثة مفيدة إذا كنت بصدد إنشاء تطبيق، مثل Google Drive، يتيح للمستخدمين امتلاك حسابات متعدّدة تم تسجيل الدخول إليها (على سبيل المثال، حساب شخصي وحساب عمل). يمكنك
استخدام مثيل مخصّص لتطبيق Firebase
للمصادقة على كل حساب إضافي.
استخدام حِزم متعددة في Cloud Storage
إذا أردت استخدام حزمة Cloud Storage غير الحزمة التلقائية الموضّحة أعلاه، أو استخدام حِزم Cloud Storage متعددة في تطبيق واحد، يمكنك إنشاء مثيل من FirebaseStorage يشير إلى حزمتك المخصّصة:
// Get a non-default Storage bucketfinalstorage=FirebaseStorage.instanceFor(bucket:"gs://my-custom-bucket");
العمل باستخدام الحِزم المستورَدة
عند استيراد حزمة Cloud Storage حالية إلى Firebase، عليك منح Firebase إذن الوصول إلى هذه الملفات باستخدام الأداة gsutil المضمّنة في Google Cloud SDK:
ولا يؤثر ذلك في الحِزم التي تم إنشاؤها حديثًا، لأنّ إعدادات التحكّم التلقائية في الوصول تكون مضبوطة على السماح لـ Firebase. هذا إجراء مؤقت، وسيتم تنفيذه تلقائيًا في المستقبل.
استخدام تطبيق Firebase مخصّص
إذا كنت بصدد إنشاء تطبيق أكثر تعقيدًا باستخدام FirebaseApp مخصّص، يمكنك إنشاء مثيل من FirebaseStorage تم إعداده باستخدام هذا التطبيق:
// Use a non-default Appfinalstorage=FirebaseStorage.instanceFor(app:customApp);
الخطوات التالية
استعد لإطلاق تطبيقك:
فعِّل App Check للمساعدة في ضمان أنّ تطبيقاتك فقط هي التي يمكنها الوصول إلى حِزم التخزين.
يمكنك مراقبة لوحة بيانات الاستخدام والفوترة
في وحدة تحكّم Firebase للحصول على صورة شاملة عن استخدام مشروعك
في العديد من خدمات Firebase. يمكنك أيضًا الانتقال إلى لوحة بيانات استخدام Cloud Storage للحصول على مزيد من المعلومات التفصيلية حول الاستخدام.
تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["\u003cbr /\u003e\n\nCloud Storage for Firebase lets you upload and share user generated content, such\nas images and video, which allows you to build rich media content into your\napps. Your data is stored in a\n[Google Cloud Storage](//cloud.google.com/storage) bucket --- an\nexabyte scale object storage solution with high availability and global\nredundancy. Cloud Storage for Firebase lets you securely upload these files\ndirectly from mobile devices and web browsers, handling spotty networks with\nease.\n\nBefore you begin\n\n1. If you haven't already, make sure you've completed the\n [getting started guide for Flutter apps](/docs/flutter/setup).\n This includes:\n\n - Creating a Firebase project.\n\n - Installing and initializing the Firebase SDKs for Flutter.\n\n2. Make sure your Firebase project is on the [pay-as-you-go Blaze pricing plan](/pricing). If\n you're new to Firebase and Google Cloud, check if you're eligible for a\n [$300 credit](/support/faq#pricing-free-trial).\n\n| **Important** : The following changes to pricing plan requirements are happening for Cloud Storage for Firebase. Learn more in the [FAQs](/docs/storage/faqs-storage-changes-announced-sept-2024).\n|\n| - **Starting\n| October 30, 2024** , your Firebase project must be on the [pay-as-you-go Blaze pricing plan](/pricing) to provision a new Cloud Storage for Firebase default bucket. The bucket can optionally use the [\"Always Free\" tier](https://cloud.google.com/storage/pricing#cloud-storage-always-free) for Google Cloud Storage.\n| - **Starting\n| October 1, 2025** , your Firebase project must be on the [pay-as-you-go Blaze pricing plan](/pricing) to maintain access to your default bucket and all other Cloud Storage resources. Any `*.appspot.com` default bucket will maintain its current no-cost level of usage even on the Blaze pricing plan.\n\nCreate a default Cloud Storage bucket\n\n1. From the navigation pane of the [Firebase console](//console.firebase.google.com/), select **Storage**.\n\n If your project is not yet on the pay-as-you-go Blaze pricing plan, then you'll be\n prompted to upgrade your project.\n2. Click **Get started**.\n\n3. Select a [location](/docs/storage/locations) for your default bucket.\n\n - Buckets in `US-CENTRAL1`, `US-EAST1`, and `US-WEST1` can take advantage of the\n [\"Always Free\" tier](https://cloud.google.com/storage/pricing#cloud-storage-always-free) for Google Cloud Storage.\n Buckets in all other locations follow\n [Google Cloud Storage pricing and usage](https://cloud.google.com/storage/pricing).\n\n - If you'd like, you can later\n [create multiple buckets](#use_multiple_storage_buckets), each with its\n own location.\n\n4. Configure the Firebase Security Rules for your default bucket. During development,\n consider [setting up your rules for public access](#set_up_public_access).\n\n5. Click **Done**.\n\nYou can now view the bucket in the\n[Cloud Storage *Files* tab](https://console.firebase.google.com/project/_/storage/)\nof the Firebase console. Your default bucket name format is\n\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.firebasestorage.app`.\n| **Note:** Starting October 30, 2024, all new default Cloud Storage buckets have the name format \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.firebasestorage.app`. Any default buckets created *before* that date have the name format \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.appspot.com`. Learn more in the [FAQs](/docs/storage/faqs-storage-changes-announced-sept-2024#all-changes-default-storage-bucket).\n\nSet up public access\n\nCloud Storage for Firebase provides a declarative rules language that lets you\ndefine how your data should be structured, how it should be indexed, and when\nyour data can be read from and written to. By default, read and write access to\nCloud Storage is restricted so only authenticated users can read or write\ndata. To get started without setting up [Firebase Authentication](/docs/auth), you can\n[configure your rules for public access](/docs/storage/security/rules-conditions#public).\n\nThis does make Cloud Storage open to anyone, even people not using your\napp, so be sure to restrict your Cloud Storage again when you set up\nauthentication.\n\nAdd the Cloud Storage SDK to your app\n\n1. From the root of your Flutter project, run the following command to install\n the plugin:\n\n flutter pub add firebase_storage\n\n2. Once complete, rebuild your Flutter application:\n\n flutter run\n\n3. Import the plugin in your Dart code:\n\n import 'package:firebase_storage/firebase_storage.dart';\n\nSet up Cloud Storage\n\n1. Run `flutterfire configure` from your Flutter project directory. This\n updates the Firebase config file (`firebase_options.dart`) in your app's\n codebase so that it has the name of your default Cloud Storage bucket.\n\n | **Note:** Alternatively to updating your config file, you can explicitly specify the bucket name when you create an instance of `FirebaseStorage` (see next step). You can find the bucket name in the [Cloud Storage *Files* tab](https://console.firebase.google.com/project/_/storage/) of the Firebase console.\n2. Access your Cloud Storage bucket by creating an instance of\n `FirebaseStorage`:\n\n final storage = FirebaseStorage.instance;\n\n // Alternatively, explicitly specify the bucket name URL.\n // final storage = FirebaseStorage.instanceFor(bucket: \"gs://\u003cvar\u003eBUCKET_NAME\u003c/var\u003e\");\n\nYou're ready to start using Cloud Storage!\n\nNext step? Learn how to\n[create a Cloud Storage reference](/docs/storage/flutter/create-reference).\n\nAdvanced setup\n\nThere are a few use cases that require additional setup:\n\n- Using Cloud Storage buckets in [multiple geographic regions](//cloud.google.com/storage/docs/bucket-locations)\n- Using Cloud Storage buckets in [different storage classes](//cloud.google.com/storage/docs/storage-classes)\n- Using Cloud Storage buckets with multiple authenticated users in the same app\n\nThe first use case is perfect if you have users across the world, and want to\nstore their data near them. For instance, you can create buckets in the US,\nEurope, and Asia to store data for users in those regions to reduce latency.\n\nThe second use case is helpful if you have data with different access patterns.\nFor instance: you can set up a multi-regional or regional bucket that stores\npictures or other frequently accessed content, and a nearline or coldline bucket\nthat stores user backups or other infrequently accessed content.\n\nIn either of these use cases, you'll want to\n[use multiple Cloud Storage buckets](#use_multiple_storage_buckets).\n\nThe third use case is useful if you're building an app, like Google Drive, which\nlets users have multiple logged in accounts (for instance, a personal account\nand a work account). You can\n[use a custom Firebase App](#use_a_custom_firebaseapp)\ninstance to authenticate each additional account.\n\nUse multiple Cloud Storage buckets\n\nIf you want to use a Cloud Storage bucket other than the default provided above,\nor use multiple Cloud Storage buckets in a single app, you can create an instance\nof `FirebaseStorage` that references your custom bucket: \n\n // Get a non-default Storage bucket\n final storage = FirebaseStorage.instanceFor(bucket: \"gs://my-custom-bucket\");\n\nWorking with imported buckets\n\nWhen importing an existing Cloud Storage bucket into Firebase, you'll\nhave to grant Firebase the ability to access these files using the\n`gsutil` tool, included in the\n[Google Cloud SDK](//cloud.google.com/sdk/docs/): \n\n gsutil -m acl ch -r -u service-PROJECT_NUMBER@gcp-sa-firebasestorage.iam.gserviceaccount.com gs://YOUR-CLOUD-STORAGE-BUCKET\n\nYou can find your project number as described in the [introduction to\nFirebase projects](/docs/projects/learn-more#project-number).\n\nThis does not affect newly created buckets, as those have the default access\ncontrol set to allow Firebase. This is a temporary measure, and will be\nperformed automatically in the future.\n\nUse a custom Firebase App\n\nIf you're building a more complicated app using a custom `FirebaseApp`, you can\ncreate an instance of `FirebaseStorage` initialized with that app: \n\n // Use a non-default App\n final storage = FirebaseStorage.instanceFor(app: customApp);\n\nNext steps\n\n- Prepare to launch your app:\n - Enable [App Check](/docs/app-check) to help ensure that only your apps can access your storage buckets.\n - Set up [budget alerts](/docs/projects/billing/avoid-surprise-bills#set-up-budget-alert-emails) for your project in the Google Cloud Console.\n - Monitor the [*Usage and billing* dashboard](//console.firebase.google.com/project/_/usage) in the Firebase console to get an overall picture of your project's usage across multiple Firebase services. You can also visit the [Cloud Storage *Usage* dashboard](//console.firebase.google.com/project/_/storage/usage) for more detailed usage information.\n - Review the [Firebase launch checklist](/support/guides/launch-checklist)."]]