Multipart file upload in v 0.5+


Back in 0.3.9 we had the apistar.parsers.MultiPartParser which we could use for file uploads. I am a little in the dark now as to how to accept file uploads in the 0.5+ versions. Can anyone help?


I don’t know if this component still works but used to in 0.3.9.

FormFiles = Dict[str, FileStorage]

def get_file_array(request_data: http.RequestData) -> FormFiles:
    return {
        name: file_storage
        for name, file_storage in request_data.items()
        if isinstance(file_storage, FileStorage)

component = Component(FormFiles, init=get_file_array)


Is FileStorage in this case the werzeug.datastructures.FileStorage?


Yes, was it. Hope that still is.


Ok, finally had time to look at this. I went back to the 0.3.9 implementation and just updated it for APIStar >= 0.4.