Problem in transfering call details to Drupal Server

Hi everyone,
I wrote a Dialplan and API in php which is called from dialplan whenever the call is hangup. This API copy the recorded audio massages and other call detail files to the drupal server. The problem is that, transferring files only possible when their is good internet signal but this is not in all case.Some time internet may not work. what should be the best option to prevent file losing because of poor internet signal.