<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: shan oa</title>
    <description>The latest articles on DEV Community by shan oa (@oa_shan).</description>
    <link>https://dev.to/oa_shan</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F464026%2Fcc5984c1-579b-4752-8fc3-9c5d8e7b4942.jpg</url>
      <title>DEV Community: shan oa</title>
      <link>https://dev.to/oa_shan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/oa_shan"/>
    <language>en</language>
    <item>
      <title>Image and Data Upload Issue in Flutter.</title>
      <dc:creator>shan oa</dc:creator>
      <pubDate>Sat, 05 Sep 2020 14:34:18 +0000</pubDate>
      <link>https://dev.to/oa_shan/image-and-data-upload-issue-55ap</link>
      <guid>https://dev.to/oa_shan/image-and-data-upload-issue-55ap</guid>
      <description>&lt;p&gt;Friends,&lt;br&gt;
  I have to Upload an Image and related Data to ASP.net API(Server).&lt;br&gt;
API , I tested with Postman and it works fine. But I am not able to Upload that from Flutter.&lt;br&gt;
It Shows Loading and not getting any response.&lt;br&gt;
So please help me to fix this issue.&lt;br&gt;
I have uploaded an Image of my code here and add the same below.&lt;/p&gt;

&lt;h1&gt;
  
  
  CODE
&lt;/h1&gt;

&lt;p&gt;Future&amp;gt; imageUploader(File fl) async&lt;br&gt;
  {&lt;br&gt;
    print("Inside imageUploader() File = $fl");&lt;br&gt;
    setState(()&lt;br&gt;
    {&lt;br&gt;
      pr.show();&lt;br&gt;
    });&lt;br&gt;
    final mimeTypeData = lookupMimeType(fl.path, headerBytes: [0xFF, 0xD8]).split('/'); &lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;final imageUploadRequest = http.MultipartRequest('POST', apiUrl);  

final fileNew = await http.MultipartFile.fromPath('half_body_image', fl.path,contentType: MediaType(mimeTypeData[0], mimeTypeData[1]));

imageUploadRequest.files.add(fl);
imageUploadRequest.fields['name'] = imgFileName;
imageUploadRequest.fields['imgCatag1'] = imgCategory1;

try
{
  final streamedResponse = await imageUploadRequest.send();
  final response = await http.Response.fromStream(streamedResponse);

  if (response.statusCode != 200)
  {
    return null;
  }
  final Map&amp;lt;String, dynamic&amp;gt; responseData = json.decode(response.body);
  return responseData;
}
catch (e)
{
  print(e);
  return null;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

</description>
      <category>doubt</category>
    </item>
  </channel>
</rss>
