uploading to S3 bucket from Codeigniter

chaky

Hi have the S3 bucket library in the codeigniter and I'm try to upload a file from a folder but it give me error. Much appreciated if some one could point out what I'm doing worng.

In the Module folder below code.

  $this->load->library('s3');
  $bucket = "xxxxxxxxxx";
  $file = "http://localhost/xxxx/backup/01.txt";
  $this->s3->putObjectFile($file, $bucket, 'test', S3::ACL_PUBLIC_READ);

I get the below error.

A PHP Error was encountered

Severity: User Warning
Message: S3::inputFile(): Unable to open input file: http://localhost/xxxx/backup/01.txt
Filename: libraries/S3.php
Line Number: 310
lluisi

Check the inputFile method, its been used by putObjectFile. This checks whether a file or directory exists but you're using an url.

public static function inputFile($file, $md5sum = true)
{
    if (!file_exists($file) || !is_file($file) || !is_readable($file))
    {
        trigger_error('S3::inputFile(): Unable to open input file: ' . $file, E_USER_WARNING);
        return false;
    }
    return array('file' => $file, 'size' => filesize($file),
        'md5sum' => $md5sum !== false ? (is_string($md5sum) ? $md5sum :
                        base64_encode(md5_file($file, true))) : '');
}

Is this a file on your server? Just add the path of your file:

$this->load->library('s3');
$bucket = "xxxxxxxxxx";
$file = "/filesystem/backup/01.txt";
$this->s3->putObjectFile($file, $bucket, 'test', S3::ACL_PUBLIC_READ);

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

Uploading a Dataframe to AWS S3 Bucket from SageMaker

Best choice of uploading files into S3 bucket

In AWS S3 Bucket Uploading images as 0 Bytes

Uploading object into transfer accelerated S3 bucket using PHP

Copy from Google Cloud Storage Bucket to S3 Bucket

Copy content from one S3 bucket to another S3 bucket with different keys

Authorization issue when uploading image to the s3 bucket using Android

Uploading files to S3 account from Linux command line

Serve subfolders from separate S3 bucket

How to create a folder on s3 bucket from python script?

R reactiveFileReader reading from aws s3 bucket

Python: Read CSV from S3 bucket with `import csv`

Export data from QlikSense cloud to AWS S3 bucket

In your web app, when uploading files to S3, is it safe to upload them directly to S3 from the client side?

Why am I getting a 403 error when uploading to S3 from the browser?

Architectural and design question about uploading photos from iPhone app and S3

Importing libraries in AWS Lambda function code from S3 bucket

Unable to access AWS s3 bucket from Private Google cloud composer

Presto: How to read from s3 an entire bucket that is partitioned in sub-folders?

Fetch jar files from AWS s3 bucket and display in Jenkins choice parameter

How to setup aws-sdk to get file content from a public file in s3 bucket?

How to read csv file from s3 bucket in AWS Lambda?

How to load JSON data (call from API) without key directly to S3 bucket using Python?

R - How to copy and paste files from one location to another within an s3 bucket (using aws.s3)?

Uploading to s3, with success callback on iOS

AWS LastModified S3 Bucket different

List contents of AWS S3 bucket

Wildcard at end of principal for s3 bucket

Link S3 Bucket with Dynamodb android?

TOP 一覧

  1. 1

    モーダルダイアログを自動的に閉じる-サーバーコードが完了したら、Googleスプレッドシートのダイアログを閉じます

  2. 2

    セレンのモデルダイアログからテキストを抽出するにはどうすればよいですか?

  3. 3

    CSSのみを使用して三角形のアニメーションを作成する方法

  4. 4

    ドロップダウンリストで選択したアイテムのQComboBoxスタイル

  5. 5

    ZScalerと証明書の問題により、Dockerを使用できません

  6. 6

    PyCharmリモートインタープリターはプロジェクトタブにサイトパッケージのコンテンツを表示しません

  7. 7

    Windows 10でのUSB入力デバイスの挿入/取り外しの検出

  8. 8

    Excel - count multiple words per cell in a range of cells

  9. 9

    PictureBoxで画像のブレンドを無効にする

  10. 10

    Windows 10 Pro 1709を1803、1809、または1903に更新しますか?

  11. 11

    スタート画面にシャットダウンタイルを追加するにはどうすればよいですか?

  12. 12

    Python / SciPyのピーク検出アルゴリズム

  13. 13

    Luaの文字列から特定の特殊文字を削除するにはどうすればよいですか?

  14. 14

    Pythonを使用して、リストからデータを読み取り、特定の値をElasticsearchにインデックス付けするにはどうすればよいですか?

  15. 15

    LinuxでPySide2(Qt for Python)をインストールするQt Designerはどこにありますか?

  16. 16

    goormIDEは、ターミナルがロードするデフォルトプロジェクトを変更します

  17. 17

    QGISとPostGIS(マップポイント(米国の地図上にraduisを使用した緯度と経度)

  18. 18

    MLでのデータ前処理の背後にある直感

  19. 19

    ターミナルから「入力ソースの変更」ショートカットを設定する

  20. 20

    パンダは異なる名前の列に追加します

  21. 21

    同じクラスの異なるバージョンを使用したクラスローディング:java.lang.LinkageError:名前の重複クラス定義を試行しました

ホットタグ

アーカイブ