本文实例讲述了php实现SAE上使用storage上传与下载文件的方法。分享给大家供大家参考。具体如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
<?php if ( $_FILES [ "file" ][ "error" ] > 0) { echo "Error: " . $_FILES [ "file" ][ "error" ] . "<br />" ; } else { echo "Upload: " . $_FILES [ "file" ][ "name" ] . "<br />" ; echo "Type: " . $_FILES [ "file" ][ "type" ] . "<br />" ; echo "Size: " . ( $_FILES [ "file" ][ "size" ] / 1024) . " Kb<br />" ; echo "Stored in: " . $_FILES [ "file" ][ "tmp_name" ]; } $s = new SaeStorage(); $i = 'PDF/' . $_FILES [ 'file' ][ 'name' ]; //文件名 $domain = 'store' ; //storage名 $s ->upload( $domain , $i , $_FILES [ 'file' ][ 'tmp_name' ] ); //上传 ?> <html> <body> <form action= "test3.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> </body> </html> |
希望本文所述对大家的php程序设计有所帮助。