這篇文章主要介紹了php實現SAE上使用storage上傳與下載文件的方法,實例分析了基于SaeStorage類實現文件傳輸的技巧,需要的朋友可以參考下
本文實例講述了php實現SAE上使用storage上傳與下載文件的方法。分享給大家供大家參考。具體如下:
- <?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程序設計有所幫助。
新聞熱點
疑難解答