I’m making a client-server program for picking a file from a location on a Mac desktop and then copying it into a iPhone simulator. Then, it’ll upload it to the server using the TCP protocol.
Can anyone please suggest how to do it or can suggest a site where I can learn about it. I got the following code on internet, will it perform the above required task?
if ( [[NSFileManager defaultManager] isReadableFileAtPath:source] )
[[NSFileManager defaultManager] copyPath:source toPath:destination handler:nil];
[[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation source:foldername destination:@"" files:filenamesArray tag:&tag];
Have a look at ASIHTTPRequest: http://allseeing-i.com/ASIHTTPRequest/
Following is the piece of code I use ASIHTTPRequest to upload a file.
NOTE, the variable recorderFilePath is the path to a audio file, this is a file I created in app document directory, added following code to your header file, will help you to get your document directory.