How to store remote attachments to your OSS instance with PHPWind

Last Updated: May 04, 2017

Preface

The website remote attachment function refers to directly storing uploaded attachments to a remote storage server, which is usually a remote FTP server, over the FTP.

Currently, Discuz forums, PHPWind forums, and WordPress websites support the remote attachment function.

This document instructs you on storing remote attachments from a PHPWind-based forum.

Preparation

Apply for an OSS account and create a public-read bucket. You must set the permission to public-read because it must allow anonymous access.

Procedures

The PHPWind we use is PHPWind 8.7 and the configuration process is as follows.

  1. Log on to the website.

    Go to the management interface and select Global -> Upload Settings -> Remote Attachments.

  2. Configure the function.

    1. Set “Enable FTP uploads“ to “Yes“.
    2. Set “Website Attachment Address“ to “http://bucket-name.endpoint“. Here, we will test the bucket test-hz-jh-002 from the Hangzhou region. Therefore, we enter http://test-hz-jh-002.oss-cn-hangzhou.aliyuncs.com, where the BucketName must match the endpoint.
    3. Set the FTP server address, that is, the address that runs the OSS-FTP. Generally, this is 127.0.0.1.
    4. Set “FTP service port No.” to the default “2048“.
    5. Set “Remote attachment directory” to “.“, that is, to create a directory for upload under the root directory of the bucket.
    6. Set “FTP Account” in the format of AccessKeyID/BucketName, where “/“ does not mean “or“.
    7. Set “FTP Password” to AccessKeySecret. To obtain the AccessKeyID and AccessKeySecret, you can log on to the Alibaba Cloud console and go to Access Key Management.
    8. Set the FTP timeout time. If you set it to “10”, a timeout response is sent if a request does not receive a response within 10 seconds.
  3. Verification

    PHPWind does not allow users to directly test the function by clicking a test button. Therefore, we must publish a post with an image to verify the function.

    Right-click the image and select “Open image in new tab”. The image is displayed in a new tab.

    The image URL indicates that the image has been uploaded to bucket test-hz-jh-002 in the OSS.

Thank you! We've received your feedback.