WFileUpload allow to upload files, it is working fine for me and it is nice.
But now I want to upload some sounds recorded by the microphones too.
I don't think this is possible with WFileUpload.
I inject html code like this:
wContainerWidgetObject->addNew<Wt::WText>("<html code>", Wt::TextFormat::UnsafeXHTML);
and I add the .js and .php files.
No matter of how I do it with
XMLHttpRequest (like here https://blog.addpipe.com/using-recorder-js-to-capture-wav-audio-in-your-html5-web-site/) or with the most common way with
ajax (like here https://makitweb.com/how-to-upload-image-file-using-ajax-and-jquery/), I always come to a point where I have no error on the console, everything seems to be ok but I notice that the file is not uploaded on the server.
There is something that forbid to do it? There is something to set the wt config xml file for that?
I already tried to set big number for "max-memory-request-size", "max-request-size" and "max-formdata-size", but I still have the problem. (and again with WFileUpload it is working)
ajax way I even try to modify the jquery.min.js to have this function, after that the function was found but still no file is uploaded)
Thank you for your help,
Wt is really nice in general.
Updated by Korneel Dumon about 1 month ago
to upload a file, the easiest way is to create a
WResource. When you send data to the url of the resource, it will be available to you in
WResource::handleRequest(), at which point you can save it to a file. This is also sort of how
WFileUpload works internally.
I guess your way of injecting JS will work, but Wt actually has some facilities for this, have a look at:
I'm not sure which of these is most useful to you, it depends a bit on your design.
Updated by Jocelyn Martin 23 days ago
I did that according to your answer.
But I still don't see how to have a
WResource pointing to the
blob object that is representing the WAV. (cf last lines of this code example)
If I succeed to do it I am ok to propose a merge request to add a widget for audio recording on Wt and to add an example project that uses it like you are used to do it.