-
-
Notifications
You must be signed in to change notification settings - Fork 345
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
Feature: Http Multipart (File upload) #694
Comments
For all upload requests I get a Bad Request reply.
It is filesize dependent. I presume it is hitting the NETWORK_MAX_HTTP_PARSING_LEN boundary. |
I am just on mobile.. But I think I know where this issue is related to: The first paket does include the header and already data. (the reverse to
|
I am on windows 8.1, Firefox 44. Tried with Chrome |
Can you send me the binary files? I tested with images and pdfs
|
I can confirm that firefox handles it differently. Will need to dive deeper into this |
OK. another idea. can you extend your http upload example with sdcard ? ;) |
Currently not - there are several things to consider before extending the upload to anything but spiffs.
For now lets keep things as simple as possible and extend it once this part is stable |
@alonewolfx2 : The SDCard is a library, not part of Sming Core and as such does not have a "Sming designed" interface. We can not use that for core functionality. |
@patrickjahns Hello, i can't compile your example with the branch you supplied. Could you try to update sming to the latest version, so we can compile your example with the updated Sming? Or could i just replace some Sming core files to match the modifications you did? if yes, wich files? Thanks |
In my opinion it's important feature and should be merged to Sming. |
Post parameters with multipart encoding should be implemented with the upcoming Http refactoring (#1112). |
In the branch "feature/http-multipart-post" I am currently extending the webserver to include multipart requests (file uploading).
Please help to test the feature/branch and provide feedback in this issue
Copy of the Initial PR:
Currently it provides functionality to:
To enable uploading for a certain path, a delegate has to be provided:
void addPath(String path, HttpPathDelegate callback, HttpUploadDelegate uploadcallback);
The uploadcallback function is defined as following:
The function has thus access to the current request in the sense of all Header and Query Paramters (as well as path) can be accessed to decide if we accept the upload (or not)
In the pathdelegate information about the uploaded files is accessible by calling:
HttpUpload is defined as
after a successfull upload
curSize
andbufferdata
will be NULL and not accessible anymore (to avoid tampering with ittype
contains the content-type field valuesname
is the variable name defined in the form fieldIf we receive a http-multipart-request without a filename or if the filename is empty - the data will be treated as normal http-post parameters and is accessible via
getPostParameter
- the limitNETWORK_MAX_HTTP_PARSING_LEN
applies to all data that is not a file.For testing see the working examples in
samples/HttpServer_Upload
Please test it thoroughly and provide feedback. If you encounter any issues, it would be great if you document what has lead to the issue and provide a debug log.
Do you have any suggestion/remarks?
Known limitations/issues:
(it seems that chrome sends the header again when one presses go-back to the fileupload page)
how should we handle this use case? how to inform the user - automatically or should the "user of the framework" take care of this in the callback?
The text was updated successfully, but these errors were encountered: