Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nikhil Joshi 15 posts 86 karma points
    Sep 05, 2016 @ 12:38
    Nikhil Joshi
    0

    Download (any) file from Umbraco website page

    Hello helpers! I need to provide a simple "Download a file" link on the web page to the users but unable to do it, below are the steps I tried, please help.

    Steps:

    1. Created new folder in "Media" and uploaded a file. Post uploading it shows link as "/media/6492/file.pgn".

    2. In webpage, created hyperlink with href as "/media/6492/file.pgn" and save.

    3. Go to the url (its valid) and click on #2 link and it shows: The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

    4. I went back and checked "file.pgn" in "Media" folder and it exists with the same link.

    Thanks a lot for helping (in advance)!

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Sep 05, 2016 @ 12:52
    Alex Skrypnyk
    1

    Hi Nikhil,

    "/media/6492/file.pgn" - are you sure that .pgn is right extention of file?

    I'm sure that ".pgn" format isn't supported by IIS.

    Thanks,

    Alex

  • Nikhil Joshi 15 posts 86 karma points
    Sep 05, 2016 @ 12:55
    Nikhil Joshi
    0

    Hello Alex, thanks for quick response, unfortunately our file extensions are ".pgn" only. But does that mean that it is impossible to implement download link for PGN files in Umbraco?

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Sep 05, 2016 @ 12:55
    Alex Skrypnyk
    0

    It means that we have to add .pgn extention as static content to web.config or iis settings.

    Read more:

    https://www.iis.net/configreference/system.webserver/staticcontent/mimemap

  • Nikhil Joshi 15 posts 86 karma points
    Sep 05, 2016 @ 13:00
    Nikhil Joshi
    0

    Hello Alex, I just know how to reach to the backend umbraco web page, is there any guidelines/steps which can help me in updating web.config or iis settings?

    I am not a .NET guy.

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Sep 05, 2016 @ 13:11
    Alex Skrypnyk
    0

    Nikhil, no problem.

    Just open web.config file and go to the "staticContent" section and add this row:

    <mimeMap fileExtension=".pgn" mimeType="image/png" />
    

    enter image description here

    Thanks,

    Alex

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Sep 05, 2016 @ 13:24
    Alex Skrypnyk
    0

    Ask, please, if something not clear.

    Oleksandr

  • Nikhil Joshi 15 posts 86 karma points
    Sep 05, 2016 @ 13:39
    Nikhil Joshi
    0

    My file extension is PGN, and your code says image/PNG.

    PGN is a kind of text file.

    On other hand, you have mentioned to update the config file, do you mean perform GIT clone to local, update the file, and push it to remote?

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Sep 05, 2016 @ 14:07
    Alex Skrypnyk
    0

    Nikhil, if your file extention is png, why did you ask at the begin of this topic about hyperlink with "/media/6492/file.pgn" href?

    PGN is a kind of image file.

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Sep 05, 2016 @ 14:08
    Alex Skrypnyk
    0

    If you have png file - you have not change config. It should work like "/media/6492/file.png"

    Thanks,

    Alex

  • Nikhil Joshi 15 posts 86 karma points
    Sep 05, 2016 @ 14:13
    Nikhil Joshi
    0

    My bad, updated my existing comment a minute ago:


    My file extension is PGN, and your code says image/PNG.

    PGN is a kind of text file.

    On other hand, you have mentioned to update the config file, do you mean perform GIT clone to local, update the file, and push it to remote?

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Sep 05, 2016 @ 14:15
    Alex Skrypnyk
    1

    Nikhil, than you need this line:

    <mimeMap fileExtension=".pgn" mimeType="application/x-chess-pgn" />
    

    Hope it will solve your problem.

    Thanks,

    Alex

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Sep 05, 2016 @ 14:16
    Alex Skrypnyk
    0

    On other hand, you have mentioned to update the config file, do you mean perform GIT clone to local, update the file, and push it to remote?

    You have to update config file on the server, local or dev or live, don't know how many environments do you have.

    Thanks,

    Alex

  • Nikhil Joshi 15 posts 86 karma points
    Sep 05, 2016 @ 14:20
    Nikhil Joshi
    0

    That is another dilemma, how to update the file in say DEV enviornment? Do you mean perform GIT clone to local, update the file, and push it to remote or else there is any other easy way?

    Sorry I am not umbraco expert and only knows about back office web pages.

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Sep 05, 2016 @ 14:24
    Alex Skrypnyk
    1

    Of course you need to pull, update and push to remore repo.

    But I don't know where is your site hosting?

    Do you have access to web site files?

    FTP or RDP?

    Thanks,

    Alex

  • Nikhil Joshi 15 posts 86 karma points
    Sep 05, 2016 @ 15:37
    Nikhil Joshi
    0

    Just have GIT, I will try to pull, update and push and let you know.

  • Nikhil Joshi 15 posts 86 karma points
    Sep 06, 2016 @ 04:18
    Nikhil Joshi
    0

    Excellent, it worked Alex, you are genius!

Please Sign in or register to post replies

Write your reply to:

Draft