How to use the storage service of SAE. Using the storage service of SAE, I finally understood how to use the storage of sae. Because sae does not support file permission settings, all code files are uncounted. However, sae provides the storage service usage of the special SAE.
Today, I finally learned how to use sae storage.
Because sae does not support file permission settings, all code files are uncounted. However, sae provides a particularly good distributed file storage service for storing persistent files. It is actually used to store website material files, slices, files, and so on.
Therefore, you can use sae when you need to store file data.
There are two solutions for using sae.
An official solution is:
Using the official storage class, you can directly perform file operations, such as storing, deleting, and modifying files.
There is also a method I saw in the sae app store, which contains a synthetic wordpress for sae.
We can see the detailed Code. I now paste my simple test code below: (only to implement storage, not applicable to development scenarios)
The code is as follows: |
|
$ 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 directly use the move_uploaded_file function to upload temporary files. Note that the second parameter $ upload_dir = "saestor: //". $ domain. "/". $ dir.
$ Domain is the name of the storage service created in storage. $ Dir is the directory to store.
To store the file in saestor: // mydomain/dir1/dir2/dir3. You can directly use this url without using the mkdir function, because the stotage has automatically created this directory.
Parse finally understands how to use the storage of sae. Because sae does not support file permission settings, all code files are uncounted. But sae provides special...