Appending data to a file on a FTP server in iOS - iphone

After learning the basics from Apple's SimpleFTPSample project, I'm trying to append a string to the end of a .txt file on my FTP server. I successfully managed to overwrite an existing file with a custom string, but I suspect that the kCFStreamPropertyAppendToFile property that defines whether the file will be overwritten or appended is not available in iOS.
What is the recommended way to do so in iOS?

Eventually I ended up downloading the file's content using HTTP (it's much faster than FTP). Next, appending the string to the file's content and then uploading the file to the server using FTP.
This might not be the best solution, but it does solve the problem.

Related

Can I upload already-encoded content to azure media services, instead of uploading a video and then encoding it? How?

I want to encode locally and upload to avoid spending money in encoding.
Is this allowed? I did not find any documentation on it.
When I simply uploaded a file to the storage, the media services account said it could not play it without the ISM file. I had to encode (was it re-encode? it was an mp4) the file I had uploaded - I want to avoid that.
Yes, absolutely allowed and encouraged for customers. Especially ones that have custom encoding requirements that we may not support.
You can upload an .ism file that you create along with your encoded files. It's a simple SMIL 2.0 format XML file that points to the source files used.
It's a bit hard to find searching the docs, but there is a section outlining the workflow here - https://learn.microsoft.com/en-us/azure/media-services/latest/encode-dynamic-packaging-concept#on-demand-streaming-workflow
There is also a .NET Sample showing how to do it here:
https://github.com/Azure-Samples/media-services-v3-dotnet/tree/main/Streaming/StreamExistingMp4
You can see the code line at 111 that shows how to generate the .ism file -
// Generate the Server manifest for streaming .ism file.
// This file is a simple SMIL 2.0 file format schema that includes references to the uploaded MP4 files in the XML.
var manifestsList = await AssetUtils.CreateServerManifestsAsync(client, config.ResourceGroup, config.AccountName, inputAsset, locator);

getting file information without uploading using scala

Can we get file information such as filesize, path of a file(even a large one) without actually uploading it onto the server using scala? PS. I know it can be done using Javascript, but I am searching for another way.

File Uploading in Sakai

I want to know if there is a 'right' way to make file uploads through custom tools.
I've seen the https://confluence.sakaiproject.org/display/BOOT/File+Uploads+with+RSF guide and it seens ok, but It stops with the file in memory with no further info. I can built a random file upload code but I want to make it Sakai-friendly (Using ContentHosting and Resources service?)
Any hints?
Thanks
The link you provided for the first part is a good example of how to get the upload initially processed. Going through RequestFilter will get your files validated, but you can use whatever method you want to upload it.
For the second part, I'd look at the ContentHosting webservice (createContentItem) for an example of how to add a file from a byte[] in memory after you've uploaded it.
These methods in ContentHostingService also accept InputStream as a parameter as of 2.7 (KNL-325), so you don't have to store the entire file in memory and can stream it as you're uploading, which you should do if the files are of any reasonable size.

download multiple files using SimpleFTPSample

I've been trying to figure out how to download multiple files in a row based on the SimpleFTPSample provided by apple. Basically, I'm filtering what the user can see when they browse an ftp server, but when they select a certain file type, I want it to automatically check for another file of the same name with a different extension and if it exists, download it as well. I can't seem to get this second file to download no matter what I do. It seems strange because if I select two files in a row in my tableview, it downloads both of them just fine. Any ideas?
Edit:
It's just the SimpleFTPSample from apple.developer.com, all I did was create additional NSInputStream and NSOutputStream objects and I created a new _startReceiveFile method that gets called from _startReceive if I'm downloading a file instead of getting a directory listing. _startReceiveFile is the same code for _startReceive in the file download code for the sample project, except if the file to download has a certain extension, it also downloads an additional file with the additional stream objects. Let me know if I need to clarify more or try to put together a clear example.
Well, since there were no takers, I'll just post my solution here. I've abandoned trying to download two files at once. Instead, I just keep the ftp browsing window open and only handle the opening of the file once both files have been downloaded (user has clicked on each one separately). It's not what I wanted, but it will work, at least until I can figure out how to get two files with one request.

Upload text file on FTP server using iPhone

I have implemented code for uploading images and directory to FTP using iPhone.
But I need to upload text file on FTP using iPhone. Can you please send me code for that.
Here's an example:
http://modmyi.com/forums/iphone-ipod-touch-sdk-development-discussion/328541-ftp-usage-iphone-applications.html
It uploads one byte at a time, so be sure your strings are ASCII encoded if you are expecting ASCII.
Here is a script to upload entire directory including text, binary etc. files. It creates subdirectories as needed.
http://www.biterscripting.com/SS_FTPUpload.html
Start with that script and change it to suit your particular situation.