Ejemplo n.º 1
0
 /**
  * Moves an uploaded file to a destination folder
  * 
  * @param string $file The name of the php (temporary) uploaded file
  * @param string $dest The path (including filename) to move the uploaded file to
  * 
  * @return boolean The success of the operation
  */
 public function upload($file, $dest)
 {
     $rrs = false;
     $absolute_filename = $this->app->path->path('zlfw:changelog.txt');
     // Legacy single part uploads
     $result = $this->s3->putObject(AEUtilAmazons3::inputFile($absolute_filename, false), 'milcom.testing', 'changelog.txt', AEUtilAmazons3::ACL_BUCKET_OWNER_FULL_CONTROL, array(), array('x-amz-storage-class' => $rrs ? 'REDUCED_REDUNDANCY' : 'STANDARD'));
     // $this->s3->setError('You have not set up your Amazon S3 Access Key');
 }
Ejemplo n.º 2
0
function AMP_s3_save($file_path)
{
    if (!AMP_SYSTEM_FILE_S3_KEY) {
        return false;
    }
    if (!($data = file_get_contents($file_path))) {
        return false;
    }
    static $s3_connection = false;
    $type = mime_content_type($file_path);
    $file_name = basename($file_path);
    $clean_file = str_replace(" ", "%20", $file_name);
    $file_path = str_replace($file_name, $clean_file, $file_path);
    $object_id = str_replace(AMP_pathFlip(AMP_LOCAL_PATH . '/'), '', $file_path);
    $bucket = AMP_SYSTEM_FILE_S3_BUCKET;
    if (!$s3_connection) {
        require_once "s3/s3.class.php";
        $s3_connection = new s3();
    }
    return $s3_connection->putObject($object_id, $data, $bucket, NULL, $type);
}