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 />";
	}
UK Electronic Designer
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.

Comments

Your email address will not be published.