This tutorial uses two examples to show how to transfer the file in HTML form directly to the OSS.
- Example 1: Describes how to add a signature on the server (PHP) and then upload the file directly to the OSS using a form.
- Example 2: Describes how to add a signature on the server (PHP), and set the callback upon uploading on the server. Then, upload the form directly to the OSS. After that, the OSS calls back the application server and returns the result to the user.
Every OSS user may use the upload service. Because the data is uploaded using Web pages, including some HTML5 pages in some apps, and there is a strong demand for the uploading service, many users choose to upload files to the application server through browsers/apps, and then the application server uploads the files to the OSS.
This method has three drawbacks:
Low uploading speed
Files are first uploaded to the application server, and then to the OSS. Therefore, the workload of transmission over the Internet doubles. If data is directly transferred to the OSS without passing through the application server, the speed will increase significantly. Moreover, the OSS uses BGP bandwidth, thus ensuring a high speed for operators in different places.
As the number of users increases in the future, the application server may constitute a bottleneck.
The traffic consumed for uploading files directly to the OSS is free of charge. If data is uploaded directly to the OSS without passing through the application server, the costs of several application servers can be saved.