Skip to content

๐Ÿ“ฆ File Upload & Download via S3 Object Storage in Merciglobal Cloud ERP

This guide outlines the usage of the ociS3 class for uploading and downloading files with OCI Objects Storage - S3-compatible object storage, within the Merciglobal Cloud ERP ecosystem.


๐Ÿ”ง Class Overview: ociS3

The ociS3 class enables seamless interaction with S3 object storage systems. It is primarily used by internal modules and services in Merciglobal Cloud ERP to handle binary file transfers like invoices, ZIP archives, reports, and more.

โœ… Available Methods:

1. upload($filename, $contents='')

Uploads a local file to the object storage.

  • Parameters:

  • $filename (string): Name or key for the object in S3

  • $contents (string): Data / File Contents
  • Returns: bool โ€“ success status
$s3 = new ociS3();
$s3->upload('trn_sales_123', file_get_contents('/path/to/filenameWithExt'););

๐Ÿ“Œ *In the example above, the contents is uploaded with the key trn_sales_123

2. download($filename, $destinationPath)

Downloads an object from storage to a local file system.

  • Parameters:

  • $filename (string): Key of the file in S3

  • $destinationPath (string): Local path where the file should be saved
  • Returns: bool โ€“ success status
$s3 = new ocis3();
$s3->download('trn_sales_123', rootPath() . '/abcProject/images/myFile.zip');

๐Ÿ“Œ *The file with key trn_sales_123 is downloaded and saved locally as rootPath() . '/abcProject/images/myFile.zip'


๐ŸŽฏ Use Cases

  • Uploading files / user custom files
  • Downloading template files or system backups
  • Managing file synchronization across ERP environments

๐ŸŒฉ๏ธ Benefits of Using OCI Object Storage Over Normal Storage

Oracle Cloud Infrastructure (OCI) Object Storage offers multiple advantages compared to traditional local, block, or file storage systems. Below are the key benefits:


๐Ÿš€ 1. Scalability

  • Handles millions of objects without performance degradation.
  • No physical drives, partitions, or capacity planning required.

โ˜๏ธ 2. Accessibility Anywhere

  • Accessible globally via REST APIs, SDKs, or CLI tools.
  • Ideal for distributed teams and cloud-based applications.
  • No dependency on a single server or mounted filesystem.

๐Ÿ’ธ 3. Cost Efficiency

  • Zero maintenance cost โ€” Oracle manages the infrastructure.

๐Ÿ” 4. Data Security

  • Data encryption at rest and in transit by default.
  • IAM-based access control for fine-grained permissions.
  • Private endpoints available for restricted access within your VCN.
  • Supports pre-authenticated requests for temporary access.

๐Ÿงพ 5. Durability & Reliability

  • 11 nines (99.999999999%) durability โ€” built-in redundancy across Availability Domains.
  • Protection against hardware failures, corruption, or accidental deletion.
  • Optional versioning for recovering older file versions.

โš™๏ธ 6. Integration with OCI Services

  • Works seamlessly with OCI Compute, Autonomous Database, Data Flow, and AI Services.
  • Easily used as a backend storage layer for ERP, CRM, or PWA applications.
  • API-first design simplifies integration and automation.

๐Ÿ” 7. Lifecycle Management

  • Automatic tiering to move old data to Archive storage.
  • Define rules for auto-deletion or archival after a set duration.
  • Reduces long-term costs while maintaining compliance.

๐Ÿ“Š 8. Performance & Parallelism

  • Supports multipart uploads and parallel downloads for large files.
  • Optimized for high throughput and data reliability.
  • Ideal for backups, analytics, and big data operations.

๐Ÿงฉ 9. Simplicity

  • No file system hierarchy โ€” everything is an object with metadata and a unique URL.
  • S3 API compatibility simplifies migration or hybrid setup.
  • Easy to integrate with custom applications.

๐Ÿง  10. Ideal Use Cases

โœ… Backup and disaster recovery
โœ… File sharing and public content hosting
โœ… Static website deployment
โœ… Data lake or analytics workloads
โœ… ERP or enterprise app storage backend


๐Ÿ Summary

OCI Object Storage = Secure, scalable, API-driven, and cost-efficient cloud storage.
Normal Storage = Best for local, low-scale, or transactional workloads.


๐Ÿง  Developer Tips

  • Always check if the file exists before attempting upload.
  • Use meaningful file keys (like customer_invoices_2025.zip) for better manageability.
  • Handle error cases using try-catch or by checking the boolean return value.

๐Ÿ’ฐ Pricing Structure

The following table highlights typical pricing for S3 object storage in Merciglobal Cloud ERP:

Tier Storage Limit Monthly Price (USD)
Standard 100 GB $28
Advanced 500 GB $100
Enterprise 1 TB+ Custom Pricing

Prices are subject to regional tax and may vary by deployment.


๐Ÿ“Œ Summary

The ociS3 class is a powerful utility for managing object storage in Merciglobal Cloud ERP. Its simple interface allows developers and ERP modules to upload and download files efficiently, promoting seamless data portability and backup reliability.