This uses an old aws method

Upload A Saved File


	$upload_file = 
	if (file_exists($upload_file))
	{
		try
		{
			$options = array('key' => $s3_accesskey, 'secret' => $s3_secretkey);
			$s3 = new AmazonS3($options);
	
			//Upload file
			$response = $s3->create_object($s3_thumbnails_bucket, basename($upload_file), array(
					'fileUpload' => $upload_file,
					//'storage' => AmazonS3::STORAGE_REDUCED,
					'acl' => AmazonS3::ACL_PUBLIC
					));
		
			if ($response->isOK())
					echo "Upload  success";
			else
					echo "Upload failed";
		}
		catch (Exception $e)
		{
			echo 'Upload exception: ',  $e->getMessage(), "<br />";
		}
	}

Upload An Open File


	try
	{
		$options = array('key' => $s3_accesskey, 'secret' => $s3_secretkey);
		$s3 = new AmazonS3($options);
		
		//Open the file
		$fileResource = fopen($output_file, 'r');
	
		//Upload file
		$response = $s3->create_object($s3_thumbnails_bucket, basename($output_file), array(
				'fileUpload' => $fileResource,
				//'storage' => AmazonS3::STORAGE_REDUCED,
				'acl' => AmazonS3::ACL_PUBLIC
				));
	
		if ($response->isOK())
				echo "Upload  success";
		else
				echo "Upload failed";
	}
	catch (Exception $e)
	{
		echo 'Upload exception: ',  $e->getMessage(), "<br />";
	}
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.

Comments

Your email address will not be published.