How to write to an FTP?

Hello everyone,

In an app i'm recording a sound and let the user upload it to an FTP (.caf file).

Writing it to the FTP isn't really working out, should I use CFWriteStreamWrite or something else?

Can someone help me out please?


Thanks!

Grtz

Robby

Answered by DTS Engineer in 26027022

I've moved your post over to Core OS > Networking because the big issue you face here isn't the language but the frameworks.

Firstly, don't use FTP. FTP is very ugly protocol with many serious issues, but the real kicker is its total lack of security. This makes it unsuitable for use on the modern Internet IMO, especially for uploads where you have to worry about the fact that it transmits user credentials (user name and password) in the clear!

I generally recommend that folks use HTTP (better yet, HTTPS) for file uploads.

If you insist on sticking with FTP, the framework support is rather limited. Specifically, CFNetwork supports a CFFTPStream 'class' that allows you to download, upload, list a directory (modulo FTP's foibles), and create a directory. The best place to start with CFFTPStream the SimpleFTPSample sample code.

If you need features beyond what's provided by CFFTPStream, you will have to either write or acquire your own FTP library.

Be aware that we've formally deprecated CFFTPStream in the latest pre-release SDKs. I don't expect that we'll remove it from the system any time soon, but this formal deprecation is a strong indication of the way the wind is blowing.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
Accepted Answer

I've moved your post over to Core OS > Networking because the big issue you face here isn't the language but the frameworks.

Firstly, don't use FTP. FTP is very ugly protocol with many serious issues, but the real kicker is its total lack of security. This makes it unsuitable for use on the modern Internet IMO, especially for uploads where you have to worry about the fact that it transmits user credentials (user name and password) in the clear!

I generally recommend that folks use HTTP (better yet, HTTPS) for file uploads.

If you insist on sticking with FTP, the framework support is rather limited. Specifically, CFNetwork supports a CFFTPStream 'class' that allows you to download, upload, list a directory (modulo FTP's foibles), and create a directory. The best place to start with CFFTPStream the SimpleFTPSample sample code.

If you need features beyond what's provided by CFFTPStream, you will have to either write or acquire your own FTP library.

Be aware that we've formally deprecated CFFTPStream in the latest pre-release SDKs. I don't expect that we'll remove it from the system any time soon, but this formal deprecation is a strong indication of the way the wind is blowing.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

CFWriteStreamCreateWithFTPURL is now deprecated. Are there any other APIs that allow a data upload by FTP?

Lenny1357 wrote:

Yes, you can Use the NSUrl session api.

NSURLSession doesn’t support FTP upload.

Hardy wrote:

CFWriteStreamCreateWithFTPURL is now deprecated. Are there any other APIs that allow a data upload by FTP?

No. Frankly, you should stop support FTP because it’s not secure enough for the modern Internet.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
How to write to an FTP?
 
 
Q