SAE's Storage service Usage _php Tutorial

Source: Internet
Author: User

How to use SAE's storage service


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. But the SAE offers a particularly good Distributed file storage service for storing persistent files. is actually used to store the site's material files, tablets, files and so on.

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

There are a total of two options for using SAE.

One of the programmes officially provided is:

Using the official storage class, the file can be manipulated directly, such as storing files, deleting files, modifying files and so on.

Another way I saw in the SAE App store was that there was a synthetic WordPress for SAE.

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

The code is as follows








!--? php

$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"]. "
";
}
Else
{
echo "Upload:". $_files["File" ["Name"]. "
";
echo "Type:". $_files["File" ["type"]. "
";
echo "Size:". ($_files["File" ["Size"]/1024). "Kb
";
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.

Where $domain is the name of the storage service created in storage. $dir is the directory to be stored.

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

http://www.bkjia.com/PHPjc/895551.html www.bkjia.com true http://www.bkjia.com/PHPjc/895551.html techarticle The SAE Storage service usage method has finally figured out how the SAE storage is used today. Because the SAE does not support file permission settings, all code files are not counted. But SAE offers a special ...

  • 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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.