title: Upload expo image to ColdFusion server
body: <p>I'm trying to upload a image from react native expo-image to my ColdFusion server.</p>
  
  <p>My react native component:</p>
  
  <pre><code>import * as ImagePicker from 'expo-image-picker';
  ...
  _pickImage = async () =&gt; {
      const result = await ImagePicker.launchImageLibraryAsync({
        mediaTypes: ImagePicker.MediaTypeOptions.All,
        allowsEditing: true,
        aspect: [4, 3],
      });
  
      if (!result.cancelled) {
        this.setState({ image: result.uri });
      }
    };
  
    _takePicture = async () =&gt; {
      const result = await ImagePicker.launchCameraAsync({
        allowsEditing: true,
        aspect: [4, 3],
      });
  
      if (!result.cancelled) {
        this.setState({ image: result.uri });
      }
    }
  
  ...
  
  &lt;View style={{ flexDirection: 'row', flexWrap: 'wrap' }}&gt;
      &lt;Button onPress={this._pickImage}&gt;
          &lt;Text&gt;Select a Image&lt;/Text&gt;
      &lt;/Button&gt;
      &lt;Button onPress={this._takePicture}&gt;
          &lt;Text&gt;Take a Picture&lt;/Text&gt;
      &lt;/Button&gt;
  &lt;/View&gt;
  ...
  </code></pre>
  
  <p>Then, in my action file I send to my .cfc file using axis</p>
  
  <pre><code>export const addWO = (obj) =&gt; {
    return (dispatch) =&gt; {
      const formData = new FormData();
      formData.append('file', obj.image);
      console.log('&gt;&gt; formData &gt;&gt; ', formData);
      axios.post('http://myServer/MyCFC.cfc?method=myMethod',
            formData, {
              headers: {
                'Content-Type': 'multipart/form-data'
              }
            }
        ).then 
       ...
  </code></pre>
  
  <p>In my .cfc file, I try to upload using fileUpload (CFScript):</p>
  
  <pre><code>destination = expandPath("./myFolder/");
  if(!directoryExists(destination)){
      directoryCreate(destination);
  }
  fileUpload(destination, arguments.File, "*", "MakeUnique" );
  </code></pre>
  
  <p>When I run it, the arguments.File contains:</p>
  
  <pre><code>file:///Users/myUser/Library/Developer/CoreSimulator/Devices/AE9B608B-3FFB-4C72-8971-C14D56E978F7/data/Containers/Data/Application/116E6C9C-B7EA-429B-8C4A-D89AF777BAA6/Library/Caches/ExponentExperienceData/%2540anonymous%252FiRentApp-5f186599-13ec-4736-b728-f84288e5a0cc/ImagePicker/3762AF23-5F01-453D-B257-E1FB25832994.jpg
  </code></pre>
  
  <p>However, the ColdFusion .cfc returns the error:</p>
  
  <pre><code>The form field file:///Users/myUser/Library/Developer/CoreSimulator/Devices/AE9B608B-3FFB-4C72-8971-C14D56E978F7/data/Containers/Data/Application/116E6C9C-B7EA-429B-8C4A-D89AF777BAA6/Library/Caches/ExponentExperienceData/%2540anonymous%252FiRentApp-5f186599-13ec-4736-b728-f84288e5a0cc/ImagePicker/3762AF23-5F01-453D-B257-E1FB25832994.jpg did not contain a file.
  </code></pre>
  
  <p>How can I upload a file from expo-image to the server?</p>
  
  <p>Thank you.</p>
  
  <p>I found the problem. We need to add the uri to the forData:</p>
  
  <pre><code>const imgName = 'myIMG.png';
  formData.append('test', { uri: obj.image, name: imgName });
  ``
  </code></pre>