<form action="upload.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>
upload.php如下:
<?php
header("content-Type: text/html; charset=utf-8");
$s = new SaeStorage();
if ($_FILES["file"]["error"] > 0){
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}else{
if( $s->upload( "images" , "headPicture/test.jpg" , $_FILES["file"]["tmp_name"]) ){ //images是stroge的名,headPicture/test.jpg路径加文件名
echo "上传成功";
}else{
echo "上传失败";
}
}
?>