5

Is it possible to append a file to a question on https://mathematica.stackexchange.com/questions/ask

4
  • 1
    Yes, example here: mathematica.stackexchange.com/a/264684/363. In this case demo files are zipped and embedded in an image. Commented Nov 27, 2022 at 10:26
  • 3
    Does this answer your question? Upload large amount of data more easily
    – xzczd Mod
    Commented Nov 27, 2022 at 11:29
  • 1
    This 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.
    – rhermans
    Commented Nov 27, 2022 at 11:34
  • 1
    There are always services like pastebin.com....
    – Michael E2
    Commented Nov 29, 2022 at 3:10

2 Answers 2

2

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"]

enter image description here

16

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:

You must log in to answer this question.

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