[Paulo Lopes]:
I am facing a problem trying to handle file uploads. It could be that i am doing it wrong.
I have a request and i set 3 callbacks:
* uploadHandler
- here i just keep a reference to all HttpServerFileUpload
* dataHandler
- here is just keep track of the upload size. i accumulate the buffer size and if it is bigger than e predefined size i abort the request
endHandler
- here i notify my app to continue
So after the endHandler is called I was setting the handlers on HttpServerFileUpload
* dataHandler
* endHandler
The problem is that when i set the handlers on HttpServerFileUpload they never get called
So I tried to set them directly inside the uploadHandler and in this case it works.
Now i would like to *delay* to set the HttpServerFileUpload handlers later since i might want to do some processing in between setting the original uploadHandler and the fileuploadHandlers is it possible?
I can't see how that should be possible without having to store the file data somewhere (memory or an upload folder) and then when endHandler is called use the uploaded files.
I looked into the code and there is a pause and resume method on the HttpServerFileUpload, however it pauses the whole request and does not work in my case.
I don't think it can work any other way. The HttpServerFileUpload is part of the request and the only way to pause a file upload is to pause the whole request.
I was thinking if there is such as thing that could hold the data in some buffer until the data/end handlers are set on the HttpServerFileUpload.