Is it possible to append a file to a question on https://mathematica.stackexchange.com/questions/ask
-
1Yes, example here: mathematica.stackexchange.com/a/264684/363. In this case demo files are zipped and embedded in an image.– Chris DegnenCommented Nov 27, 2022 at 10:26
-
3Does this answer your question? Upload large amount of data more easily– xzczd ModCommented Nov 27, 2022 at 11:29
-
1This question has been asked and answered before . In any case, you should, in most cases, avoid large data or code, by providing a minimum working example, with code that generates simple synthetic data, if necessary. If inevitable to share the data, the method should be permanent, safe and easy to retrieve.– rhermansCommented Nov 27, 2022 at 11:34
-
1There are always services like pastebin.com....– Michael E2Commented Nov 29, 2022 at 3:10
2 Answers
Download the notebook thusly
extractNB[file_String] := Uncompress@Last@
StringSplit[URLFetch@file, "Embedded data:"]
writeNB[png_String, nb_String] := Module[{},
outputstream = OpenWrite[
FileNameJoin[{$InitialDirectory, nb}],
BinaryFormat -> True];
BinaryWrite[outputstream, extractNB@png];
Close[outputstream]]
writeNB["https://i.sstatic.net/4eeTp.png",
"retrieved notebook.nb"]
Doing this is technically possible by "misuing" SE's image hosting, as Chris's answer shows. However, my opinion on this topic is that you just shouldn't try attach notebooks.
Part of what makes SE's QA format work is that questions must fit into limited space. This forces the asker to do their part of the work: minimize their code+data example, explain the issue concisely, be on point and focus on a single issue. I believe that in the great majority of cases attachments are not necessary, and would make the question problematic (less clear, less easily answerable).
If you search meta, you will find similar opinions being expressed: