Sitecore XM Cloud PowerShell Receive-File Returning "cancel"

The ‘file.pdf' file cannot be uploaded. File type isn’t allowed.

May 27, 2025

By Roberto Barbedo

Receive-File Stops Working in Sitecore PowerShell

I encountered an unexpected issue using Sitecore PowerShell Extensions (SPE) in XM Cloud.

$item = Receive-File -ParentItem (Get-Item "master:/sitecore/media library") -Overwrite
Write-Host $item

This used to return the uploaded media item.

Now it returns:

cancel

No item is created in the Media Library.

Initial Investigation

  • The file dialog opens, and I can select a file.
  • Manual upload of the same file via the Media Library UI works fine.
  • No file is added to the media library

Found the Clue in Logs

By checking the CM logs in the XM Cloud Deploy App:

WARN [SPE] The 'myfile.pdf' file cannot be uploaded. File type isn’t allowed.

That was it — XM Cloud was rejecting the file upload silently due to new restrictions.

Sitecore Support Response

Sitecore confirmed a security enhancement had been rolled out:

This update introduced safeguards against unauthorized file uploads. It allows configuration of permitted file types and upload paths.

Configuration can be checked at:

https://<your-instance>/sitecore/admin/showconfig.aspx

Here’s the relevant default section:

<sitecore>
  <powershell>
    <uploadFile>
      <allowedFileTypes>
        <pattern>image/*</pattern>
      </allowedFileTypes>
      <allowedLocations>
        <path>temp</path>
      </allowedLocations>
    </uploadFile>
  </powershell>
</sitecore>

Fixing with a Config Patch

I needed to patch the config to include additional file types:

<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <powershell>
      <uploadFile>
        <allowedFileTypes>
          <pattern>
            <patch:delete />
          </pattern>
          <pdf>.pdf</pdf>
          <doc>.doc</doc>
          <docx>.docx</docx>
          <odt>.odt</odt>
          <rtf>.rtf</rtf>
          <txt>.txt</txt>
          <md>.md</md>
          <pptx>.pptx</pptx>
          <xlsx>.xlsx</xlsx>
          <csv>.csv</csv>
          <jpg>.jpg</jpg>
          <jpeg>.jpeg</jpeg>
          <png>.png</png>
          <gif>.gif</gif>
          <bmp>.bmp</bmp>
          <tif>.tif</tif>
          <tiff>.tiff</tiff>
          <webp>.webp</webp>
          <svg>.svg</svg>
          <ico>.ico</ico>
        </allowedFileTypes>
      </uploadFile>
    </powershell>
  </sitecore>
</configuration>

Notes:

  • Each extension must be a separate XML node (not a comma-separated list).
  • You can keep image/* in addition to other types.

Important Patch Deployment Tips

  • Place your config file under /App_Config/Include/zzz.Spe/ and name it zzz.Spe.Custom.config to ensure it loads after the original.
  • Double-check /sitecore/admin/showconfig.aspx to confirm the patch took effect.
  • Do not overwrite original config files — always patch.

Final Thoughts

Thanks to Jeff and Ryan for helping unravel this. Hopefully, this saves someone else the debugging marathon.

Photo of Fishtank employee Roberto Barbedo

Roberto Barbedo

Solutions Architect

Roberto is a Sitecore Solution Architect with experience in the build and implementation of large-scale Sitecore development projects for global clients.