https://github.com/sellorm/plumber-uploader
https://github.com/sellorm/plumber-uploader
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sellorm/plumber-uploader
- Owner: sellorm
- Created: 2017-02-26T20:22:30.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2021-11-05T10:34:47.000Z (over 3 years ago)
- Last Synced: 2024-08-13T07:15:16.745Z (8 months ago)
- Language: R
- Size: 1.95 KB
- Stars: 7
- Watchers: 4
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- jimsghstars - sellorm/plumber-uploader - (R)
README
# plumber-uploader
A really hacky implementation of a file uploader in R using the [plumber](http://plumber.trestletech.com) package.
A request for a better way to do this has been [raised in the plumber project](https://github.com/trestletech/plumber/issues/75).
## Notes
* Currently only works with text based files. Binary files are corrupted on upload.
+ upload.html attempts to limit the types of file that can be uploaded to text based to help prevent corruption.
* The techniques used for extracting the file name and file body are not robust, and would be easily broken.
* There's nothing to stop you uploading a file over another file.
* I feel like plumber needs a `req$FILES` or something
* Maybe I'm missing something!
* Posting file data currently produces a warning (see below)```
Warning in if (stri_startswith_fixed(body, "{")) { :
the condition has length > 1 and only the first element will be used
Warning in if (stri_startswith_fixed(qs, "?")) { :
the condition has length > 1 and only the first element will be used
```## Warning
This is toy code at this point. Do not use!
## If you must...
Make sure the 'uploads' directory exists in the same directory as the code, then run:
```
library(plumber)
r <- plumb("./upload.R")
r$run(port=4000)
```open upload.html in your browser and have at it.
Remember I warned you not to though ;)