Articles Library: 18 Articles
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Uploading article accessories

If you have additional files that make up an article -- such as images -- you can upload them using the steps described here.

Apologies as the process is a little fiddly. There is no web interface for this yet, it is all done with the LDS API -- which means you need to start a REBOL console session.

The basic stages are:

  • contribute article: you need to do this before you can know what article-id we assign it. Without that, you cannot set the links correctly. You can at this stage save rather than publish the article so it is not visible to other Library visitors
  • find article id: get this from the URL returned when you contribute your article. Look for something like ?article=ticle=dgt5w
  • library token: a token is the API equivalent of a cookie. It proves you are you when running the LDS interface. Get it from here: Library tokens.  It will be emailed to your email address. Save it in the same folder from which you will run LDS-local.
  • run LDS: LDS is the API by which your console talks to the Library. Start a console session and execute this one line:
      do http://www.rebol.org/library/public/lds-local.r 
    You can now test if your token works:
     probe lds/send-server/use-token 'token-test [] 
    The status field should come back as:
       status: [0 0 "]  
    If so, you are ready to upload some extra files for your article.
  • upload your files using the LDS command upload-article-accessory, eg:
       my-text-file: read %my-text-file.txt
       probe lds/send-server/use-token
                'upload-article-accessory
                 reduce ["dgt5w" "my-text-file-name.txt" my-text-file]
    
       my-image: read/binary %my-image.png
       probe lds/send-server/use-token
                'upload-article-accessory
                 reduce ["dgt5w" "my-image-name.png" my-image]
     
    The lds/send-server block has three arguments:
    • article-id
    • file-name: what you want to call the file on the server
    • file contents: either a string or a binary field
    The files will be saved to a folder especially created for your article's accessories, eg (for article dgt5w)
    href="http://www.rebol.org/library/arts/accessories/dgt5w/" 
    Some commonsense validation/coercion is made to the filenames to ensure full cross-platform compatibility:
    • lowercase only
    • letters (a-z), digits (0-9), hyphens and periods (-.) only
    • first character must be a letter.
    The object that comes back in reply lists all files in the articles folder, so you can check everything is there.
  • update the article: The links in the article now need to point to the article files, eg:
    "href=http://www.rebol.org/library/arts/accessories/dgt5w/my-image-name.png" 

And you are done!