上传和下载非常相似
Uploading a File
Uploading a file is similar to downloading a file. As with downloading a file, you need a read stream and a write stream. However, when uploading a file, the read stream will be for the local file and the write stream will be for the remote file. Follow the instructions in “Setting up the Streams,” but wherever it refers to the read stream, adapt the code for a write stream and visa versa.
In the callback function, rather than looking for the kCFStreamEventHasBytesAvailable
event, now look for the event kCFStreamEventCanAcceptBytes
. First, read bytes from the file using the read stream and pl