-
-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple files in one POST request #272
Comments
Sending multiple files in one POST request is already supported. When creating or editing a shortcut, go into the "Request Body / Parameters" section, and there change the "Request Body Type" to "Parameters (form-data)". Now use the plus button at the bottom right to add your parameters. Choose the "Multiple Files" option if you want to upload multiple files in a single parameter (analogous to what Hope this helps. Let me know if something is unclear or does not work as expected. |
Thank you, I was able to reproduce the steps you told and send a desired request to the server ( and made sure I could read the files as well ) ... Something I'd like to ask you, "the order in which I select files in the file picker" isn't the same as the order in which i recieve files on the server side code. the are arranged alphabetically according to their respective content-types. Anyway, I could keep the same order on the server while recieving files as well. Also thanks for this awesome app ✨ |
Unfortunately, the order of the files is given by the file picker, which is not part of the HTTP Shortcuts app but the Android OS (or possibly some other third-party app). As such, the files are uploaded in no particular order, and the actual order may be random or decided by the picker. There isn't an easy way to fix this, short of building a fully custom file picker into the app, but that would come with drawbacks of its own. |
thanks for the help, I would have wanted the order of the files to persist but guess I'll work with what I've got. ik this might be a stretch, but is there a function in the |
Unfortunately, the entire file handling is currently not accessible by the Scripting feature, or only in a read-only manner. I'm looking into extending that though, as there's also been other related feature requests and ideas floating around, e.g., this one. For now, I don't see an easy workaround. You could create multiple single-file parameters in your shortcut, but that would mean that the number of files to be uploaded is constant, which is probably not what you want. |
The following does not directly address the issues described above, but perhaps it is helpful in some ways anyway. With version 2.16.0, there is now the possibility to forward files that were selected in the file picker to another shortcut. It is not (yet) possible to open a file picker directly through Scripting, but you can just add a file parameter to your shortcut so that a file picker is invoked when the shortcut is triggered. You can then access the selected files via the You'll find more information about this here: https://http-shortcuts.rmy.ch/scripting#files and https://http-shortcuts.rmy.ch/scripting#trigger-shortcut |
sorry for the late reply ... Using the suggested way: I will then have to manually rename each file in ascending order ... ^^" The only possible way I see this happening is if
thanks for your time ✨️ |
As the file picker is not part of the app, but comes from Android itself or from another app, I have no control over it. The only way to achieve this reliably would be to build a custom file picker into the app, which would have its own drawbacks
This would be feasible, but requires a lot of effort to build. I'll keep the idea in the backlog, but will not focus on it for now. I want to make some general improvements to how files are handled in the app, so maybe it fits in with that broader topic, but currently I have no timeline for that. |
The file picker option in the app doesn't support multiple files as of now, ( correct me if I'm wrong ) ... neither does it support
Content-Type=multipart/form-data
... I know in a simple html form u can write something as `<input .... multiple="multiple" encoding="multipart/form-data" ... say I wanted to POST a request to that endpoint containing many files..I'd like to see some kind of support for sending multiple ( say image files ) in a POST request preferably through the same file picker
Alternative: probably, using
application/json
and sending files after converting them into base64 then writing more server side logic to parse the json and covert them back to images, that's inconvenient, plus you can't use variables here, as there is no present functionality that helps to simplify this( an alternative javascript solution can exist, but I'd still prefer to use the file picker ... also, the only language I know is python ... ^^")
I'm pretty new to all of this stuff, ...^^" .. so I have limited knowledge, feel free to ask more stuff or suggest me better solutions, thank you very much for your time
The text was updated successfully, but these errors were encountered: