PHP上传文件到SAE的storage

 时间:2026-02-19 14:59:59

1、注册登录SAE

2、创建一个PHP项目

3、在服务管理列表,进入Storage。

4、新建domain,命名为“test”

5、我们再回到应用管理列表,进入代码管理。创建代码版本后,编辑代码:

6、两个文件:

index.html

<html>  

<head>  

<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />  

<title>上传文件</title>  

</head>  

<body>  

所有文件  

<form enctype="multipart/form-data" action="index.php" method="post">  

<input name='myfile' type='file'/>  

<input type="submit" value="上传"/>  

</form>  

</body>  

</html> 

index.php

<?php  

$s2 = new SaeStorage();  

$name =$_FILES['myfile']['name'];  

  

echo $s2->upload('test',$name,$_FILES['myfile']['tmp_name']);//把用户传到SAE的文件转存到名为test的storage  ,$_FILES["file"]["tmp_name"] - 存储在服务器的文件的临时副本的名称

// echo $s2->getUrl("test",$name);//输出文件在storage的访问路径  

echo '<br/>';  

echo $s2->errmsg(); //输出storage的返回信息   

?>  

  • PHP使用Webuploader文件上传
  • uploadify+springmvc+ftp实现文件上传删除
  • PHP操作MongoDB GridFS 存储文件,如图片文件
  • 树莓派实现PHP上传文件
  • PHP文件上传代码方式实现
  • 热门搜索
    淘宝怎么改密码 久咳不愈怎么办 飞机是怎么飞起来的 中华保险怎么样 水龙头滴水怎么修 读书计划怎么写 增值业务费怎么取消 掉头发很厉害怎么办 胸痛怎么回事 甲鱼怎么做好吃