Add upload extension
Pretty simple extension that can't be replicated with pre-existing extensions
What would this be useful for?
I used it in my cloud chat project to have an upload file button that posts a link to the file in chat
Is this extension already possible through a combination of files and the HTTP/fetch/Network extensions?
Nope, because of how multipart/form-data uploads are created (see below), it isn't yet possible.
POST /upload HTTP/1.1
Content-Length: 428
Content-Type: multipart/form-data; boundary=abcde12345
--abcde12345
Content-Disposition: form-data; name="id"
Content-Type: text/plain
123e4567-e89b-12d3-a456-426655440000
--abcde12345
Content-Disposition: form-data; name="address"
Content-Type: application/json
{
"street": "3, Garden St",
"city": "Hillsbery, UT"
}
--abcde12345
Content-Disposition: form-data; name="profileImage "; filename="image1.png"
Content-Type: application/octet-stream
{…file content…}
--abcde12345--
Would it be possible to turn this into a more general file uploading extension?
At least a block like "set file host to [ ]", even if it only has one option for now
Would it be possible to turn this into a more general file uploading extension?
At least a block like "set file host to [ ]", even if it only has one option for now
It depends on the case. For a service like Gofile, they have multiple servers (store1, store2, etc) so there would have to be custom logic to grab the correct server from their API. Although, it could work better with both the current upload file to URL, and "upload file to [dropdown]" so there aren't any unnecessary blocks. That's one thing I hate about extensions such as numerical encoding, why have a block that just sets a custom variable when you could have a single reporter?
Anyways, I'll get started on the new block now.
Hey. something that's annoying with gofile and file.io is they dont provide direct links to the raw image. This really adds tons of limitations so I can't have the image show in my turbowarp project. Is there another hosting exactly like gofile that actually gives you the link to the raw hosted image, so i can have a plugin display the image in the project?
As far as I know, no. If I find one, I'll be sure to add support for it though.
Thanks @ClaytonTDM!
Is this getting merged or what?
Is this getting merged or what?
Please have patience, we're all volunteers here. As stated in CONTRIBUTING.md, "We'll get to you as soon as we can, so please be patient".
Edit: nevermind, patience is not required here lmao
hi, sorry for the delay, currently whittling away at a review queue that pilled up during months of long days at work
here's the deal for this extension -
- The HTTP extension does support multipart now, so this is not as necessary (but still happy to merge it, if you resolve the issues below)
- It would be great if the extension was not limited to just files on your computer already, but if it also allowed any text, such as data: URI snapshots of the stage from looks+
- Your scripts need to handle what happens when someone cancels the file dialog. At a bare minimum you can listen for the
cancelevent, which is a new thing for dealing with this, but support is still very new. This is why the file extension insists on showing a modal. - Errors in getGofileServer (for example, if someone denies the fetch) need to be handled
Sure! I've added all the changes and fixes you mentioned.
its been like a year
its been like a year
Indeed.