title: Blazor Wasm Take Phote on IOS
body: <p>In my Blazor website i'm calling the camera using this code:</p>
  <pre><code>&lt;InputFile 
      id=&quot;imageSelect&quot; 
      name=&quot;imageSelect&quot; 
      OnChange=&quot;@UploadImage&quot; 
      capture=&quot;camera&quot; 
      type=&quot;file&quot; 
      accept=&quot;image/*&quot;/&gt;
  </code></pre>
  <p>If a run the this blazor page (containing this code), the Iphone camera pops up. So that works and if I take a picture it will load in my Image:</p>
  <pre><code>&lt;img class=&quot;card-img-top img-fluid&quot; 
      src=&quot;@((IsahImageEntity.Image != null) ? utils.GetImage(IsahImageEntity.Image) : (ImageChanging ? &quot;&quot; : &quot;img/no-camera-sign.jpg&quot;))&quot; 
      alt=&quot;&quot;
  /&gt;  
  </code></pre>
  <p>So the UploadImage function wil Upload the image into the database and also set this Image property: <code>IsahImageEntity.Image</code></p>
  <p>But sometimes it doesn't work the page is automatically reloaded and the Photo (taken by the camera) isn't uploaded to the database and it isn't shown in the Img html component.</p>
  <p>Here is the UploadImage function:</p>
  <pre><code>        protected async Task UploadImage(InputFileChangeEventArgs e)
          {
              ShowSpinner = true;
              ImageChanging = true;
  
              StateHasChanged();
  
              //Remove the old picture...
              var oldImage = IsahImageEntity!.Image;
              IsahImageEntity.Image = null;
  
              //get the file
              var file = e.File;
  
              var newFile = await e.File.RequestImageFileAsync(&quot;image/png&quot;, 300, 300);
              IsahImageEntity.Image = await File2ByteArray(newFile);
              if (ForImaging)
              {
                  var bln = await SaveInDB(newFile);
  
                  if (!bln)
                  {
                      //reset the old Image
                      IsahImageEntity!.Image = oldImage;
                  }
              }
              else
              {
                  await SaveDocumentInDB(newFile);
              }
  
              ShowSpinner = false;
              ImageChanging = false;
          }
  
          private async Task&lt;byte[]&gt; File2ByteArray(IBrowserFile file)
          {
              byte[] bytes = new byte[file.Size];
  
              await file.OpenReadStream(file.Size).ReadAsync(bytes);
              
              return bytes;
          }
  </code></pre>
  <p>Anyone who recognizes this behaviour? And is there a solution. So why does the page sometimes reload instead of showing the taken photo?</p>
  <p>it seems that the problem occurs in a PWA (progressive web app) on my iphone. If i use safari (Web browser) than there seems to be no problem .</p>