Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Downloading folder or zip file [solved]

Discussion in 'Multiplayer' started by marciweleqPL, Jun 8, 2020.

  1. marciweleqPL

    marciweleqPL

    Joined:
    May 24, 2020
    Posts:
    9
    Hi,
    so i want to create "updater" for my game, but whenever i download zip file (by c#) it cannot be opened, and when i try to download folder, it shows as a file without extension. Is there way to download folder or zip file? I've tried using both, Google drive and Dropbox.

    Thanks in advice and sorry for my bad english.
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,653
    You can't download a folder, you have to download all individual files it contains.
    However, zip file download should work.
    Can you show the code how you are doing it?
     
  3. marciweleqPL

    marciweleqPL

    Joined:
    May 24, 2020
    Posts:
    9
    sure,

    Code (CSharp):
    1. using (var client = new WebClient())
    2. {
    3.     client.DownloadFile("[googledrivepath].zip", "C:\\marciweleq\\gamefiles.zip");
    4. }
    when i try to open this zip , windows says
    "Windows cannot open this file.
    Compressed folder (zip) with name [path] is not correct."
     
  4. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,653
    Check the file contents using text editor. It's possible you uri is incorrect and you actually downloaded a Google drive web page, rather than the actual file.
     
  5. marciweleqPL

    marciweleqPL

    Joined:
    May 24, 2020
    Posts:
    9
    I think that might be problem (downloading page instead of file), but do You know how to actually download file but not webpage? I found out link to my dropbox .zip folder that instantly starts download, but after inserting it in my c# script there was error:
    "Windows cannot open this file.
    Compressed folder (zip) with name [path] is not correct."

    Thank You in advice.
     
  6. marciweleqPL

    marciweleqPL

    Joined:
    May 24, 2020
    Posts:
    9
    I found solution!
    I'd to use MediaFire and insert link that apears after clicking "download" button.

    Thank You, Aurimas-Cernius!