I want to attach some files to a post on one of Stack Exchange sites. What is the best way to do this?


Use a file upload service like SkyDrive and post the link on the page like so:

<a href="http://file">file</a>
| improve this answer | |
  • 1
    I have problems with skydrive links, some users complain they can't download them. Their browser sees the skydrive URL ending in.zip and tries to download the HTML and save it as a zip. – Warren in Toronto Apr 20 '11 at 15:41
  • 1
    Good file hosting sites include Dropbox, Google Drive, OneDrive and Mediafire – Stevoisiak Jul 20 '17 at 18:15
  • And github gists – Peter V. Mørch Aug 10 '18 at 9:44
  • @StevenVascellaro It's odd. I don't consider a single one of those to bee a good filehosting site. All to often I encounter dead links after a couple of years. – Daniel F Oct 8 '18 at 9:28

Host them somewhere else and post a link. StackOverflow does not provide file hosting services.

| improve this answer | |
  • 1
    ...and there's a reason for that! – uɐɯsO uɐɥʇɐN Apr 23 '10 at 21:37
  • 5
    @GeorgeEdison ... And what is the reason? – Mukul Goel Nov 5 '12 at 8:24
  • 1
    because that can get expensive and abused. They do now though, but only 1 image file up to 2mb. Drag and drop, baby! – Dan Csharpster Feb 14 '17 at 21:51
  • drag'n drop of non-image files does not work, at least not in FF 56 – Andreas Dietrich Dec 18 '18 at 11:03

LaTeX is just code, so if you have a question about how to do something in LaTeX, just include a snippet like you would any other piece of code.

(Hint: indent it by four spaces, or select it and click the 'binary' icon in the toolbar of the edit window.)

| improve this answer | |

I'd recommend using Pastebin for this scenario

PS: Seems that people didn't notice that the requester was asking to include LaTeX files, which are markup based ones, thus they are plain text files!

| improve this answer | |
  • 3
    Not relevant. Pastebin is only for text, while the question here is about files. Anyone can post text as part of the question/answer itself. – Shadow 10 Years Wizard Jul 19 '17 at 19:49
  • 1
    @ShadowWizard Latex files are simple text files, that's why I suggested PasteBin! – Gonzalo Vasquez Jul 20 '17 at 1:05
  • 2
    How is this answer different from: meta.stackexchange.com/a/47690/158100 or the accepted answer? – rene Jul 20 '17 at 17:08
  • 1
    @rene there are huge differences from my point of view: from the link a snippet would be useful only if it's not long, as the question body has a character limit, which I've overcome before using PasteBin and, from the accepted answered both solved the problem, but in different ways as a link to a file to download, is not a link to a site where you can actually see the file contents, maybe subtle, but the are different indeed. – Gonzalo Vasquez Jul 20 '17 at 17:30
  • 1
    Ok, I've gone the extra mile. I must be missing something. I have pastebinned a LaTeX snippet that I found on GitHub. What makes PasteBin now so much different then GitHub, SkyDrive, DropBox or even a gist. So if PasteBin is so much preferable above all other filesharing options what is the extra feature that I fail to see? For a moment I thought they implemented a latex renderer or is that only available in the pro version of it? – rene Jul 20 '17 at 18:47
  • @rene I guess from your comment that Gist is even more adequate than PasteBin for this purpose, as it's "code" related and, not just text. As PasteBin and Gist post can be done anonymously, makes them waste no space from your prefered file sharing provider (DropBox, Google Drive, etc), and makes posts discardable. Maybe it's just a subjective perspective, but makes it cleaner for me – Gonzalo Vasquez Jul 20 '17 at 19:30
  • @GonzaloVasquez; pastebin has a size limit of 500KB for the free account. – Henrik Staun Poulsen May 14 '19 at 14:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .