8

Background:

It is troublesome to upload some files to Stack exchange. A possibility is to give some Google Drive or Dropbox URL but it maybe unaccessible to some people. Using the SE Uploader gives some error information like the following:

This results in the add-on not being usable in China or other places with firewalls.

Using Databin is very very slow and limits your file size.

Question:

Is there a good method to share files in Stack Exchange?

migrated from mathematica.stackexchange.com Oct 15 '16 at 18:57

This question came from our site for users of Wolfram Mathematica.

7

Thank for the J.M.'s and SqRoots' help in this post,I make a function to do this,one can use it encrypt any express in a URL.Now you just share your URL to another:

ShareAny[expr_] := 
 Module[{list, imageWidth, imageHeight, n}, 
  list = ToCharacterCode[Compress[expr]];
  {imageWidth, 
    imageHeight} = {If[(n = Ceiling[Sqrt[Length[list]/3]])*(n - 1) > 
      Length[list]/3, n - 1, n], n};
  Print[Style[
    The following expression to share is in your clipboard., 11, 
    Red]]; (CopyToClipboard@#; #) &[
   Defer[Uncompress@*FromCharacterCode@*
      Flatten@*(ImageData[#, "Byte"] &)@*Import][
    ImportString[
      URLFetch["https://sm.ms/api/upload", Method -> "POST", 
       "MultipartElements" -> {{"smfile\"; filename=\"tmp.png", 
           "image/png"} -> 
          ExportString[
           Image[ArrayReshape[list, {imageWidth, imageHeight, 3}], 
            "Byte"], "PNG"]}], "RawJSON"]["data", "url"]]]]

There is a example,you can cope with any expression,such as List,Image,Graph or other local file, like following

list = Range[10^5];
ShareAny[list]

  • You can merge the extraction of an Association[] entry as ["data", "url"] instead of ["data"]["url"]. – J. M. will be back soon Oct 15 '16 at 9:25
  • @J.M. Thanks :) – yode Oct 15 '16 at 9:26
  • Why not to use imgur.com which is associated with StackExchange? – Alexey Popkov Oct 15 '16 at 11:36
  • 1
    @Alexey, the OP complains about imgur being inaccessible from behind the Great Firewall unless a VPN is used. – J. M. will be back soon Oct 15 '16 at 11:45
  • @J.M. Thanks, never thought that this may be the case. It is not completely clear from the question though. – Alexey Popkov Oct 15 '16 at 11:56
  • Yes, hopefully he'll edit his question to say this, @Alexey. – J. M. will be back soon Oct 15 '16 at 11:57
  • @J.M. I'll research imgur. – yode Oct 15 '16 at 13:05
  • @J.M. When I try to call the Imgur API,it will give me a response like "Imgur is temporarily over capacity. Please try again later."Would you be like this? – yode Oct 21 '16 at 9:26
  • @AlexeyPopkov Can you call the imgur-API?It cost my some time but fail to make it.This is my code.Help please. – yode Feb 10 '17 at 19:57
  • @yode I have no experience with this API but it seems you've already got the answer: chat.stackexchange.com/transcript/message/35358667#35358667 – Alexey Popkov Feb 11 '17 at 5:02
  • I am a little confused. To what extent imgur is blocked by GFW? Why can you see pictures from imgur on SE, while a direct access is impossible? – happy fish Apr 5 '17 at 14:22
  • @happyfish "http://stackoverflow.com/upload/image" is a extra port for StackEchange,but not a opening API,I think. – yode Apr 5 '17 at 14:24
  • I guess that upload API just acts like a web proxy. But I meant the images you can see on SE, they should be hosted directly by imgur, wouldn't that imply imgur is not blocked? – happy fish Apr 5 '17 at 14:26
  • @happyfish No,imgur is not blocked,they just forbid their API is called by Chinese mainland user. – yode Apr 5 '17 at 14:29
  • Perhaps we need a special toolkit for Chinese users. I remember having trouble logging in without VPN. – happy fish Apr 5 '17 at 14:45
3

You can store limited amounts of data as QR images as I used here:

https://mathematica.stackexchange.com/a/73088/363

You don't need to scan them; the data can be retrieved from the image URL.

  • As the documentatation,the character limited size seem too small? – yode Oct 15 '16 at 19:39
  • Yes, it's limited. In the example linked, I tried putting the dates and two data sets in one QR file but it was too big, so I split it. – Chris Degnen Oct 15 '16 at 19:47

You must log in to answer this question.

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