iOS client library: create folder in background task

Hi there,

we are currently integrating the iOS client lib into one of our apps in order to upload generated PDFs to an ownCloud server. Before a file is uploaded, we check if the destination directory is there and create it if not; this is mandatory since the uploadFileSession: call does not create the target directory if it's not there. This works nicely if the device is connected to the Internet; if not, the create directory call fails - even though the uploadFileSession call would succeed since it supports background uploading that is started when the device comes back online.

So basically there is no chance to upload a file if the device is not connected.

What could we do to solve this? Is there a way to tell the client lib or the server to transparently create the folder path before uploading the file? Any ideas?

Thank you

Hi @m-thielen,

Yes, there is a chance, you need to store your uploads to launch them later once you get a connection.

You need to handle in the client previous to send the upload request.
Check if it exists on the server, then, handle the response, and depending of the kind of error handle as you need. You can store with different kind of error and once you have a connection relaunch all pending files to upload or the ones with the specific error you need.

1 Like