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
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]
コメントを追加