SAE上传文件到SaeStorage代码

首先这是表单:
<html>

<head>
<title>Upload</title>
<meta http-equiv=”Content-Type” content=”text/html;charset=utf-8″ />
</head>

<body>
<br>
<form enctype="multipart/form-data" action="upload.php" method="post">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="submit" />
</form>
存储遍历查找:<a href="bianli.php">Start</a>
</body>
</html>
其次是上传文件:
<?php
$s=new saestorage();
$name=$_FILES['file']['name'];
echo $s->upload('sc',$name,$_FILES['file']['tmp_name']);
echo $s->getUrl('sc', $name);
echo '<br/>';
?>
具体见这个:http://apidoc.sinaapp.com/sae/SaeStorage.html
再来就是遍历查找:
<?php
//遍历Domain下所有文件
$stor = new SaeStorage();

$num = 0;
while ( $ret = $stor->getList("sc", "*", 100, $num ) ) {
        foreach($ret as $file) {
            echo "文件名称:  {$file}n";
			echo "文件地址:  {$stor->getUrl('sc',$file)}n";
			echo "<br/><br/>";
            $num ++;
        }
}
echo "<br/>";
echo "nTOTAL: {$num} filesn";
?>