views:

75

answers:

2

Hi

I need to compress the Documents folder in the application sandbox and upload the compressed file to a server. I've been able to send files from iphone to the server, but am stuck in regards to compressing the folder. I'm using the ASIHTTPRequest libraries for connecting to the server.

Any body can point me to the right direction. I'd be highly grateful.

Thanks in advance

Nik

+1  A: 

This question is similar and i think will get you started

http://stackoverflow.com/questions/1925002/how-to-compress-data-using-zlib

Aaron Saunders
A: 

You can't alter the Documents folder itself because you don't have permission. However, you can compress files inside it. I pretty sure you can use the command line zlib to do the actual compression. Use NSTask to run it from the apps code.

TechZen
I want to compress the whole documents folder so that when I transfer data to the server, I have to send only one file. It seems easier to maintain and follow.
Nick
You can't alter the Documents folder in place. I suppose you could target the entire Documents folder for compression but write the compressed file to Library or Tmp. I think it would be better to put the files inside a folder inside Documents and then compress that folder.
TechZen
The documents folder will contain many folders and I need to compress them all. I need all of them to be sent to the server. placing the compressed file inside tmp isn't such a bad idea. I could then move it to documents folder and send it to the server.
Nick