You are trying to open a folder. You need to pass it a file...
$tmp = 'pictures/';
if (is_dir($tmp)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if(!is_file($file)){continue;}
$s3 = new S3(awsAccessKey, awsSecretKey);
if($s3->putObjectFile($tmp.$file, $bucket , * , S3::ACL_PUBLIC_READ) ){
echo "$file uploaded Successfully.";
}
}
closedir($dh);
}
}