Let's say you are building a CMS or a blog with an admin interface. It won't take long until you want to upload files to your service. There are standards for this, but eventually, you want to do something more complicated.
That's where solutions like Uppy by Artur Paikin and the team come in.
Transloadit on uppy.io, an open source JS file uploader.
I am a software engineer and interface designer from Moscow, living in New York City for the past three years. I run a small dev and design studio “Baguette” and work together withI’m passionate about DIY home automation, traveling, indie web (RSS and standalone blogs forever!), alternative living spaces (camper vans, cabins, boats) and text adventure games (80 Days, Sorcery! and Secret of the Monkey Island in particular).
Uppy is a simple file uploading widget/library for the browser. It’s modular, easy to use and lets you worry about more significant problems than building a file uploader.
I sometimes get asked why the world even needs anything beyond <input type="file">
, why bring JS into this. The truth is: for many cases <input type="file">
is fine.
Sometimes, however, you’d like to add a nice drag and drop surface with file previews and upload progress. Webcam support might be excellent to have. Picking files from your Dropbox without downloading to your mobile phone first can save a lot of bandwidth and battery life.
For large files, resumability is also essential: like surviving wifi hiccups or accidental navigate aways, and not having to start the upload from scratch.
All those things can significantly improve the user experience when uploading is a central aspect of your web/app. And Uppy can be deployed with nothing but a JS tag, using an existing <form>
for fallback, and your Apache/Nginx server.
<script>
and <style>
tags with a CDN batteries-included bundle, or pick and choose exactly the plugins you need from npm (and build yourself with, e.g., Webpack).// please replace `v0.26.0` with the latest version
<link
href="https://transloadit.edgly.net/releases/uppy/v0.26.0/dist/uppy.min.css"
rel="stylesheet"
/>
<div id="choose-files">
<form action="/upload">
<input type="file" />
</form>
</div>
<script src="https://transloadit.edgly.net/releases/uppy/v0.26.0/dist/uppy.min.js"></script>
<script>
const uppy = Uppy.Core();
uppy.use(Uppy.Dashboard, {
target: "#choose-files",
inline: true,
replaceTargetContent: true,
});
uppy.use(Uppy.Webcam, { target: Uppy.Dashboard });
uppy.use(Uppy.XHRUpload, {
endpoint: "https://mywebsite.com/receive-file.php",
});
</script>
Check out the live version on CodePen and more examples.
Everything is a plugin in Uppy. Start simple, add just what you need (or don’t): uploaders (”regular“, xhr, s3, tus), Redux integration, React components, progress bar, extracting values from the <form>
element on a page. You name it — we’ve got a plugin for it (if not, send a PR or publish your own, we’ll happily link to it. ;-)
const uppy = Uppy({
restrictions: {
maxNumberOfFiles: 3,
minNumberOfFiles: 1,
allowedFileTypes: [
"image/*" /* Mimetype */,
,
"video/*" /* Mimetype */,
],
},
});
uppy.use(Form, {
target: "#my-form",
getMetaFromForm: true,
addResultToForm: true,
});
uppy.use(ReduxDevTools);
uppy.use(AwsS3, {
limit: 2,
timeout: ms("1 minute"),
serverUrl: "https://uppy-server.myapp.com/",
});
Commercial offerings cost money and make it hard to switch. Uppy uses open standards and plugins can be written to interface with anything. We do offer a “hosted” option, but you can pack your things and move to your platform.
Besides commercial, here are a few great open source alternatives that come to mind:
How Uppy is different:
When I started working with Transloadit, we wanted to build a new file uploader for their file processing and encoding services. They already had a jQuery SDK and were looking to modernize it. Then, after some initial prototypes and thinking, we’ve decided that instead of working on a proprietary SDK, we would build an open solution for everybody to use and hack. Transloadit support became an optional plugin.
I wanted a file uploader that I could use with my static blog generator to import photos from, say, Instagram and remote URLs. I wanted it to be an open source standalone solution, so Uppy fits well.
We are preparing Uppy for a 1.0 release: stabilizing APIs, polishing docs. We’ve just completed conversion to a Lerna repo — meaning that all plugins are published as individual npm packages, but kept in a single GitHub repo — this way it’s easier to add new features in one PR, maintain issues and build tools.
Besides that, we are working on some basic React Native support, we’d like to release an Uppy WordPress plugin, add image cropping, and more options for file restrictions — our to-do list is massive, but contributors help a lot!
parcel index.html
and see you app load in the browser with all the CSS/PostCSS/JS/Babel “just working”. Tools like create-react-app
and vue-cli
(which you can even optionally configure without “ejecting”) are excellent solutions to the “configuration fatigue” as well. I also really dig Standard JS — I use it and stay productive, instead of arguing about code styles.Reading the previous SurviveJS interviews, this seems to come up a lot in our community: don’t get overwhelmed by new frameworks, libs, choices and build tools. I know it’s hard — I see a new CSS-in-JS solution I want to try every day on Twitter. :-)
In the long run, it’s more important to continue developing and publishing your work, than getting stuck mastering new tools. When you’d like to try a new idea, try it the browser with a plain index.html or on CodePen. Start simple and add things on top if needed.
Recently I’ve been seeing more developers who stick to plain CSS and JavaScript, without all the useful bloat we’ve added to it, and can’t help but long for that a little at times. So this is advice offered to me as much as the next person. :-)
I’d like to thank our team! It’s a joy to work on a fantastic open source project with unbelievably talented people: Kevin and Tim, the founders of Transloadit, who inspired and sponsored the Uppy project:
Thanks for the interview, Artur! It's great to see solutions that go beyond the standards.
To learn more about Uppy, head to their homepage, check Uppy on GitHub as well.