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

Archive version of: share-files.r ... version: 3 ... notchent 19-Jan-2014

REBOL [
    title: "Simple File Sharer"
    date: 19-Jan-2014
    file: %share-files.r
    author:  Nick Antonaccio
    purpose: {
        I use it to send lists of files to clients' phones, PCs, or any other
        Internet device they may use.  I text or email them the single short
        personal html file link created by the script, and they click the 
        contained file links to download all their files. It's a stupid simple
        script and setup which requires only a single unstructured folder on
        any available web server, to handle all the files for any number of
        potential clients, but it's a huge time saver that gets used for so
        many different practical purposes, with so many people, in so many
        situations. It's much more universally usable and straightforward
        than a service such as Dropbox.  No client software needs to be
        installed (just use any browser to download the files).
    }
]
login: request-text/default "ftp://user:pass@site.com/public_html/files/"
filename: request-text/default "links.html"
add-files: does [
    foreach file request-file [append a/text join file newline]
    show a
]
upload-files: does [
    html: copy {}
    foreach f parse a/text "^/" [
        print file: last split-path f: to-file f
        write/binary to-url join login file read/binary f
        append html rejoin [
            {<a href="} file {">} file {</a><br>} newline
        ]
    ]
    write html-file: to-url join login filename html
    browse replace replace html-file "ftp://" "http://" "public_html/" ""
]
view center-face layout [
    a: area 600x400
    across
    btn "Add Files" [add-files ]
    btn "UPLOAD FILES" [upload-files]
]