title: Swift Alamofire.upload: Type of expression is ambiguous without more context
body: <p>I'm getting the <code>Type of expression is ambiguous without more context</code> error in my code and I'm not sure why. I used the same method before and I never got this error before.</p>
  <p>I saw similar posts here regarding this error, but none of the solutions fixed it for me. For example I tried changing <code>to</code> to <code>with</code> and it didn't do anything.
  Any help would be appreciated.</p>
  <p>I'm using:</p>
  <ol>
  <li><p>Alamofire version 5.5.0</p>
  </li>
  <li><p>Xcode version 14.0</p>
  </li>
  <li><p>Swift version 5.0`</p>
  <pre><code>     Alamofire.upload(
       multipartFormData: { multipartFormData in
           if firstButtonFileType == &quot;image&quot;
           {
               let imgData = firstButtonImage.jpegData(compressionQuality: 0.5)
               multipartFormData.append(imgData!, withName: &quot;homework&quot;, fileName: &quot;homework.png&quot;, mimeType: &quot;image/png&quot;)
           }
  
           if firstButtonFileType == &quot;document&quot;
           {
               multipartFormData.append(linkOfFirstFile!, withName: &quot;homework&quot;, fileName: &quot;homework.&quot; + firstFileExtension, mimeType: &quot;application/pdf&quot;)
           }
  
           if secondButtonFileType == &quot;image&quot;
           {
               let imgData2 = secondButtonImage.jpegData(compressionQuality: 0.5)
               multipartFormData.append(imgData2!, withName: &quot;homework1&quot;, fileName: &quot;homework1.png&quot;, mimeType: &quot;image/png&quot;)
           }
  
           if secondButtonFileType == &quot;document&quot;
           {
               multipartFormData.append(linkOfSecondFile!, withName: &quot;homework1&quot;, fileName: &quot;homework1.&quot; + secondFileExtension, mimeType: &quot;application/pdf&quot;)
           }
  
           if thirdButtonFileType == &quot;image&quot;
           {
               let imgData3 = thirdButtonImage.jpegData(compressionQuality: 0.5)
               multipartFormData.append(imgData3!, withName: &quot;homework2&quot;, fileName: &quot;homework2.png&quot;, mimeType: &quot;image/png&quot;)
           }
  
           if thirdButtonFileType == &quot;document&quot;
           {
               multipartFormData.append(linkOfThirdFile!, withName: &quot;homework2&quot;, fileName: &quot;homework2.&quot; + thirdFileExtension, mimeType: &quot;application/pdf&quot;)
           }
  
           multipartFormData.append(defaults.string(forKey: &quot;user_idx&quot;)!.data(using: String.Encoding.utf8)!, withName: &quot;student_idx&quot;)
           multipartFormData.append(homework_idx.data(using: String.Encoding.utf8)!, withName: &quot;homework_idx&quot;)
           multipartFormData.append(defaults.string(forKey: &quot;school_group&quot;)!.data(using: String.Encoding.utf8)!, withName: &quot;school_group&quot;)
           multipartFormData.append(defaults.string(forKey: &quot;database&quot;)!.data(using: String.Encoding.utf8)!, withName: &quot;db&quot;)
  
       },
       with: URL_UPLOAD_FILE,
       encodingCompletion: { encodingResult in
           switch encodingResult {
           case .success(let upload, _, _):
               upload.responseJSON { response in
                   print(response)
                   if response.result.value != nil {
                   } else {
                       // internet connection error
                   }
               }
           case .failure(let error):
               print(error)
           }
       }
   )
  </code></pre>
  </li>
  </ol>