What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 140 Stack Exchange communities.

I posted a question and a couple of respondents asked for the source code. I could only post portions of the code.

If attachments were allowed I could have uploaded a .zip file with the whole application. Will this be a feature in SO?

share|improve this question

12 Answers 12

I think if you're posting a zip file of code for a question you're posting far too much.
Questions should be limited to specific problems or functions in your application so that the error can be readily seen and fixed by other members. I know I definitely wouldn't go digging through multiple files of code to try and solve an issue, but that's just me.

share|improve this answer
@Ian - While you may choose to not look over the sourcecode, that doesn't imply that another person wouldn't. It only takes one person to answer a tough question. –  RSolberg Jul 13 '09 at 17:53
No Ian, it's not just you... –  awe Mar 21 '12 at 10:44

There are lots of free file hosts you can use -- it puts us in a difficult position to be hosting arbitrary files for user.

share|improve this answer
yes, this is a nice solution...upload there, put link here. –  dde Jul 13 '09 at 12:39
If there were an API to those solutions, would SO ever implement it? –  RSolberg Jul 13 '09 at 17:53
@Chester Yes, a ton of them have API's –  bobobobo Nov 27 '11 at 14:01
If only people did this. I get that there would be problems hosting attachments, and if you don't want to dig through piles of code then don't -- down vote and move on. But for questions like this: stackoverflow.com/questions/15796659/… it would be far easier to download a project then create one, create each page, each control, gather the hosted copy of the local jquery version, cut and paste all the code, etc -- before even hitting F5. –  Jim Apr 3 '13 at 20:01
The problem with this is what happens if some of those services close? All related questions with linked files will no longer be valid!! For example I was trying to add a sample docx file as an example of where the library was failing in the conversion (but the same could be true for image files). In any case, if the free hosting solution closes the question is now useless. You can't assume these services will stay up, especially if you want to keep the integrity, and hence value, of the questions over the longer term. –  FollowSteph.com Dec 7 '13 at 3:30

I'm strongly against such a feature. StackOverflow is meant to be a knowledge exchange platform, where we try to build, say, the Wikipedia of programming questions, not a place for troubleshooting "hey, dig through my source code. fix the problem for me" issues for free.

Currently, if you look at the answers in Stack Overflow, many of them are much longer than "change that line to something else" type of answer. Many good answers here really try to explain the reason that caused the problem and many alternative suggestions. They are more like blog entries than classic answers found in forums. This is what makes Stack Overflow a unique Web site. Those answers can be useful for a lot of people, not just the OP.

As a consequence, I believe any feature that encourages asking arbitrarily long questions and make the OPs think less before asking is completely against the spirit of Stack Overflow. It would no longer be a knowledge exchange platform but place to troubleshoot specific problems, which in my opinion, is no fun at all.

share|improve this answer
the problem in your argument is you have issues with giving answers "for free"...right there, first paragraph. –  dde Jul 13 '09 at 12:41
@dde: Don't get me wrong. I don't have any problems with sharing what I know and helping people in general. I think my SO profile pretty much proves this point. The thing I want to point out is that SO is not a place for people to come and have their job done by others. It's a place they should come primarily to share what they know and learn stuff they need to get their job done on their own. Uploading a ZIP file will essentially make SO like some freelance programming Websites sans the money (BTW, I won't be participating in them anyway, so the issue is not being free). –  LeakyCode Jul 13 '09 at 14:31
Whikipedia hosts some images, sounds and (I don't know if already does) video. We could use some image uploading goodies, for the ocasional UML graph. –  perbert Jul 28 '09 at 16:40
Greeeeeeeaaaat answer! (And the right one in my opinion) –  bobobobo Nov 27 '11 at 14:02

SO allows a substantial amount of code to be posted. In all honesty, if you're finding the limit to be too little, you're probably not getting close enough to your problem before posting your question.

Many people, not accusing you, ask questions like "What's wrong with this?" and then plaster 100 lines of code into their browser (many times un-tabbed). Try not to be that person. Instead, use your error-reporting to determine what problematic section should be copied. That, or ask a more general question about your issue and extract a solution from the answers.

share|improve this answer
I see your point. Anyway, I managed to obtain an answer posting a few lines. I just though right at that moment it could have been very easy to upload what respondents were asking for. BTW, out of curiosity, how much amount of code is allowed? –  dde Jul 13 '09 at 12:46

I'm actually a bit surprised by the amount of negative emotions towards this in general... As Mehrdad pointed out, Stack Overflow is a great knowledge exchange platform. I completely agree. It is an excellent knowledge exchange platform. But why must we limit knowledge transfer to text?

The ability to upload supporting docs/code/images/etcetera to questions and answers is definitely a limitation of the overall SO experience. As Jonathan pointed out, questions that are along the lines of "hey whats wrong with these 200 lines of code" are going to be frowned upon. These questions will be met by down-votes and folks asking what the specific issue is. If someone were to post a project in a zip file and say "whats wrong with my project, it doesn't work"), it'll be met by huge resentment with downvotes, negative comments, etc.

So what do we lose by folks posting some zip files with project code in them? Do we stand to be negatively affected more by that or will our overall experience be improved? I certainly don't think it would be more negative and having this feature would only help some folks and make answers a bit more robust.

share|improve this answer
My take on this: 1) probably harms searchability. 2) discourages filtering the question down to an specific point and as a result, adds clutter, reduces the "being useful for many people", Wikipedia aspect to SO, and increases troubleshoot my very specific problem aspect which has long existed in traditional forums. 3) creates more ten questions in one posts. Uploading images and docs can be helpful but considering the free hosting services out there, copyright issues and the complexity it introduces, I don't think SO should directly support that. –  LeakyCode Jul 13 '09 at 20:09
@Mehrdad - not one of your points has an ounce of validity. How does adding files harm searchability? Searches can remain text based. If people don't ask questions properly, they'll be dinged and the behavior will not be rewarded. As the licensing and usage is already fairly well known, I don't think it adds anymore complexity as the same CC-WIKI rules can be applied to files. –  RSolberg Jul 13 '09 at 20:19
@RSolberg: I can think of questions that will show up: "hey, my code won't compile. blah blah blah." with a ZIP file attached (which is not very searchable). Sure, it'll be downvoted, but this kind of behavior is likely to increase. Regarding copyright and objectionable content, well, I can already see people copying decompiled .NET framework source code from Reflector. There's not a solid measure to prevent uploading content that you don't have the rights for. –  LeakyCode Jul 13 '09 at 20:44
Nor should be. If someone files a complain, the offending post could be deleted if appropiate. –  perbert Jul 28 '09 at 16:43

I understant there are 10's of good reasons against uploading code files, however: what if it's the answers that require some uploads?

I had the perfect code for a utility function that did exactelly what the OP was asking for. Code was 200+ lines, and would probably benefited a lot of people trying strugling with the same formatting problems.

Then you could just answer:

Well, this is the function that I use to format a DataSet into an XML-compliant Office Excel 2007 document: codegoeshere.cs

I would love to be able to upload small 10-15kb human-readable text files.

share|improve this answer

When questions exhibit more than a dozen lines of code, I switch to another one. Digging the code for finding bugs is my real life job, and I am good at it because I have spent time for learning the context. Getting into that kind of learning curve is not something I expect from Stackoverflow.

As a potential answerer, I expect from Stackoverflow that the OP has already isolated his bug and is able to present its essence to the community.

As a potential asker, I expect from Stackoverflow that the essence of the problem I am struggling against has already been exposed and solved. This will never be the case if every problem is flooded with specific context.

share|improve this answer

I've read a couple of the responses falling on the side of the argument that uploading code might be a bad thing.

Configuring and building projects can be a difficult task, especially for beginners - and sharing a Visual Studio solution may be the only way readers can determine the cause of the problem.

In short, I think uploading would be a great feature.

Youtube can store and serve all that video, so what's a few source code files by comparison?! Isn't that what the Internet's all about?

I take onboard that there are free hosting sites that specialize in hosting files, but providing a git / SVN compatible interface to SO to allow users to upload files or projects would greatly add to the quality of Stack Overflow. IMHO.

share|improve this answer

I'd like to approach this from another angle.

I spend a lot of time on the Electronics Stackexchange site, and many questions and/or answers there have links to component datasheets on external sites.

Now, I thought that the general policy was that questions and answers shouldn't rely on external sites if at all possible, so that if the external site went down / went through a restructuring, the question or answer was still complete and valid - hence the enforced use of imgur to host images.

Now, being able to attach the datasheet to the answer instead of referring to an external site must surely be a bonus to the longevity of the content in general.

I agree that uploading whole projects, or big code files is a no-no as this doesn't add any value to the content, but being able to attach files with information in to which the answer refers instead of relying on the data still being on an external site 6 months down the line has to be a big yes point.

Maybe it should only be allowed for answers, and not questions, and maybe for people with more than a certain threshold of reputation.

share|improve this answer
Hmmm... A downvote... Why, pray tell? I know this isn't the electronics site, but a change like this would happen in the core of the software, and not be specific to one site. Therefore it would be applicable to all sites, not just the programming oriented one. –  Majenko Dec 6 '11 at 16:07
your answer makes a lot of sense to me. Indeed for answers and not questions, would be my suggestion –  nawfal Dec 23 '11 at 9:35

You can use http://pastebin.com/ or GitHub Gist for long snippets and http://imgur.com/ for sharing images.

share|improve this answer
Nope, please NEVER use the public imgur. Instead, use the built-in image upload to prevent images from going missing after some time. See How to upload an image to a post? –  Arjan Mar 3 '13 at 15:10
Should be a comment, not an answer. –  Richard J. Ross III Mar 3 '13 at 15:36

No one wants to dig through an entire project to find the problem but sometimes when i post a question i think the problem lies in one part of my code but it really is something else entirely. It would be nice to be able to say here's the relevant code but here is the full file just in case my problem is in a different part. If we narrow the scope to including one file not an entire project i think is a perfectly acceptable thing to do. it should not necessarily be hosted on stack overflow but i think posting a link to the file instead of dumping it all into the question is a much better approach.

share|improve this answer
The problem with posting content outside of the SE environment is that the links may eventually rot, removing any value that the OP had. In most cases, the questioner should reduce the problem to a minimal example, which you can post completely as part of the question. –  Werner Nov 10 '14 at 21:58
@Werner I disagree that the OP would lose all value as a result of a dead link to a file. IT only has potential to help the question and solution be more complete. If the link dies and the Q&A are better because of it that death doesn't matter so much because that's not where the value lies. –  spintron Nov 11 '14 at 9:43

It is not likely that StackOverflow will implement file uploads into their service. They are trying to discourage people posting files with hundreds or thousands of lines of coding and expecting someone to spend all their time looking for the problem. Instead, S.O. wants people to only post the snippet of code which has problems so that people can easily detect the problem without breaking a sweat and to save server storage space.

However, you do have a good point for programming languages that do not exist in the form of plain text or have to interact with other elements to function, such as the old version of GameMaker (version 8.0 and below, not GameMaker: Studio). If you don't want to hear me brag about GameMaker: Studio, skip the next paragraph.

GameMaker: Studio appears to have a few removed object actions from my experience. Some actions were unknown when I opened up an object in a project file. I find it a bit slower and harder to use than V8.0.

Unlike GameMaker: Studio, where you can paste the code for certain parts of a project, GameMaker files cannot be simply viewed as readable plain text and normally problems are hidden in different parts of the file than what you think.

If you want to give people access to the files that have problems, which you should only do when you really need to, consider file sharing services like DropBox or Google Drive. While Google Drive gives you 15GB of free storage while Dropbox only gives you 2GB free, Dropbox does not care about executable files where as Google Drive will try to stop you in case of it being a virus.

Before I go, don't ask people to download the program you used to create the project file. I learned that the hard way.

EDIT: The words in italics is what I added.

share|improve this answer

You must log in to answer this question.

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