Android Question How to check if a file exist online before download?

Discussion in 'Android Questions' started by ginsh, May 1, 2015.

  1. ginsh

    ginsh Member Licensed User


    Anyone please let me know How to check if a file exist online before download when using HttpUtils2?
  2. eurojam

    eurojam Well-Known Member Licensed User

    I would use HTTP Lib for this task ( Init with the Url of your file and then use StatusCode As Int [read only]. When the Code is 200 the file will exist. I didn't tried this, it is just an idea how to start. may be there more easy or better solutions...

    Peter Simpson likes this.
  3. ThRuST

    ThRuST Well-Known Member Licensed User

    Another workaround is to download the file in a try catch and then check if the file exists locally by using a timer.
    Would be rather effective for smaller files. Perhaps not the best solution but a working alternative.
  4. ilan

    ilan Expert Licensed User

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice