diff --git a/src/ios/CDVLocalFilesystem.m b/src/ios/CDVLocalFilesystem.m index c340ce0cc..3436af686 100644 --- a/src/ios/CDVLocalFilesystem.m +++ b/src/ios/CDVLocalFilesystem.m @@ -551,8 +551,13 @@ - (void)copyFileToURL:(CDVFilesystemURL *)destURL withName:(NSString *)newName f // can't copy dir into self errCode = INVALID_MODIFICATION_ERR; } else if (bNewExists) { - // the full destination should NOT already exist if a copy - errCode = PATH_EXISTS_ERR; + // first try to remove the existing file + bSuccess = [fileMgr removeItemAtPath:newFileSystemPath error:&error]; + + if (bSuccess) { + // then copy the new one + bSuccess = [fileMgr copyItemAtPath:srcFullPath toPath:newFileSystemPath error:&error]; + } } else { bSuccess = [fileMgr copyItemAtPath:srcFullPath toPath:newFileSystemPath error:&error]; }