package com.b2lmobitech.fieldcloudhrms

import android.content.Context
import android.net.Uri
import java.io.*

object FileUtils {
    fun getFile(context: Context, uri: Uri): File? {
        val inputStream = context.contentResolver.openInputStream(uri) ?: return null
        val file = File(context.cacheDir, "temp_upload_file")
        val outputStream = FileOutputStream(file)

        inputStream.copyTo(outputStream)
        inputStream.close()
        outputStream.close()

        return file
    }
}
