# How to upload itk image to server?

**URL:** https://discourse.itk.org/t/how-to-upload-itk-image-to-server/1766
**Category:** Uncategorized
**Created:** [April 9, 2019, 9:19pm UTC](https://discourse.itk.org/t/how-to-upload-itk-image-to-server/1766 "2019-04-09T21:19:43Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Andrzej\_Marciniak](https://discourse.itk.org/user_avatar/discourse.itk.org/andrzej_marciniak/32/685_2.png) [@Andrzej\_Marciniak](https://discourse.itk.org/u/Andrzej_Marciniak)
#### Post date: [April 9, 2019, 9:19pm UTC](https://discourse.itk.org/t/how-to-upload-itk-image-to-server/1766/1 "2019-04-09T21:19:43Z")

</div>

Hello,  
I am writing VTK/ITK MRI browser/editor and I would like to save edited image on a server. I found out how to convert vtk to itk ([https://github.com/Kitware/paraview-glance/issues/180#issuecomment-408659132](https://github.com/Kitware/paraview-glance/issues/180#issuecomment-408659132)) , and now the missing part is to convert itkImage object to binary file in NIFTI format and send it.  
Is there any solution for saving ImageArrayBuffer (or directly itkImage) to buffer in memory and streaming to server, without saving to local file? Which one should I use : writeImageLocalFile, writeImageArrayBuffer?  
Thanks in advance  
Andrzej

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [April 9, 2019, 9:35pm UTC](https://discourse.itk.org/t/how-to-upload-itk-image-to-server/1766/2 "2019-04-09T21:35:56Z")

</div>

Hello @Andrzej_Marciniak,

Welcome to the ITK community! ☀

Yes, one option is to create a NIFTI-formatted binary in an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) and upload it to a server that way. Use [`writeImageArrayBuffer`](http://insightsoftwareconsortium.github.io/itk-js/api/browser_io.html#writeImageArrayBuffer-webWorker-useCompression-image-fileName-mimeType-gt-webWorker-arrayBuffer); the _arraybuffer_ data type is supported when sending the file to the server with tools like [axios](https://github.com/axios/axios). Another option is to use [`writeImageBlob`](http://insightsoftwareconsortium.github.io/itk-js/api/browser_io.html#readImageBlob-webWorker-blob-fileName-mimeType-gt-webWorker-image%60) and a _blob_.

---

<div class="post-metadata">

### Author: ![Andrzej\_Marciniak](https://discourse.itk.org/user_avatar/discourse.itk.org/andrzej_marciniak/32/685_2.png) [@Andrzej\_Marciniak](https://discourse.itk.org/u/Andrzej_Marciniak)
#### Post date: [April 9, 2019, 10:05pm UTC](https://discourse.itk.org/t/how-to-upload-itk-image-to-server/1766/3 "2019-04-09T22:05:08Z")

</div>

Thanks Matt for quick answer and welcoming. I will try with axios and arraybuffer.
