Storage Service usage for SAE

Source: Internet
Author: User
Tags mkdir

Today I finally figured out how to use SAE's storage.

Because the SAE does not support file permission settings, all code files are not counted. However, the SAE provides a particularly good distributed file storage service to store persistent files. In fact, is used to store the site's material files, such as pictures, documents and so on.

So, when you need to store the file data, you can use the SAE.

There are altogether two options for using the SAE.

One of the official programmes offered was:

Using the official storage class, you can directly perform file operations, such as storing files, deleting files, modifying files, and so on.

Another way I see it in the SAE App Store is a synthetic WordPress for SAE.

We can see the detailed code, I now put my own simple test code to the following: (only to implement storage, not for development scenarios)

  code is as follows &nbs P;
<form action= "" Method = "POST" enctype= "Multipart/form-data"
<label for= "file" >FILENAME:</LABEL>
<input type= " File "name=" file "id=" file "/> 
<input type=" Submit "name=" submit "value=" Submit "/>< br> </form>
$domain = "Test" ;
$upload _dir = "saestor://". $domain. "/QIAO1/2/3/4/5/";
if (!is_dir ($upload _dir))
 //mkdir ($upload _dir, 0777);
if ($_files["file" ["error"] > 0)
  echo "error:". $_files["File" ["Error"]. "<br/>";
  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"];
if (move_uploaded_file $_files["file" ["Tmp_name"], $upload _dir. $_files["File" [' Name '] )
 echo ' OK ';
//mkdir ($upload _dir. ' Qiao ', 0777);

We can upload temporary files directly using the Move_uploaded_file function. Note that the second parameter $upload_dir= "saestor://". $domain. “/” . $dir.

Among them, $domain is the storage service name created in storage. $dir is the directory to store.

If you want to store the file under saestor://mydomain/dir1/dir2/dir3/. You can use the URL directly, rather than using the mkdir function to create it, because Stotage has automatically created the directory.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

11.11 Big Sale for Cloud

Get Unbeatable Offers with up to 90% Off,Oct.24-Nov.13 (UTC+8)

Get It Now >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.