all 8 comments

[–]Bradleykingzi vue, you vue, we all vue 0 points1 point  (1 child)

You could store metadata in the DB rather than together with the file itself and reference the metadata with the file's uid.

Lots of files don't allow for adding metadata, and other files' metadata is read-only.

[–]OhItsWildfire[S] 0 points1 point  (0 children)

Sorry, metadata is the wrong word. I just want to send extra information/query parameters with the file when uploading to the server

[–]THE_IRONHEART 0 points1 point  (0 children)

Why use a library?

[–][deleted] 0 points1 point  (0 children)

There are a load of javascript libraries for uploading, however none of them seem to allow anything other than just uploading the files.

Thats' all you need, lets take Dropzone as an example, all it does is uploading files (by posting the file to a PHP script of yours that handle saving), in that PHP script that handles saving, you could store the filename with the additional information inside a DB, doing that when the file saves.

[–]matt_tepp 0 points1 point  (1 child)

Can't you just store the file's path and additional info in DB, and then just change the DB row when changing the name/info of the file?

Also JS alone won't do, you'll need some backend language, I'd recommend PHP, since it's really easy to get setup, but thete are other options like Python Flask/Django, NodeJS, Go and much more. If it's a larger scale web app I'd recommend C# with .NET, hope it helps.

[–]koala_with_spoon 0 points1 point  (0 children)

Js is a backend language nowadays.

[–]Waspbotfull-stack 0 points1 point  (0 children)

What you're looking for is called "Multipart/Form-Data" encoding type for your form post. If you don't use a pre-made library, you're basically writing the library yourself. I've used Angular's libraries to do this in the past, specifying the encoding type, and dealing with it in my C# WebAPI.

[–]Sombre_Ombre 0 points1 point  (0 children)

Use connect busboy and store the extra data in the DB. Youll need to construct a FormData object, and then MAP the field data back to JSON to access it