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 ...