How to upload .nii file from streamlit web st.file_uploader byte

I tried to deploy my ai to website by using streamlit. Then I want to upload the .nii file from st.file_uploader command to be the model input, so I want to upload and then open the .nii file. But the command give me as a byte from .getvalue(). I don’t know a way to convert byte to .nii(3d neuroimage file) so I first convert bytes to numpy array by np.frombuffer but it give a single 1d(16777568) that cannot reshape to 3d (256,256,256) because 1677568-(256256256) = 352 that is header of nifti file.

So do you have a better way to upload .nii file from website that you deploy (better if it use streamlit)?
Have a way to convert bytes to .nii file?
Have a way to get header or first 352 of 1d numpy.array and then put it back when reshaped it to 3d?