Sitecore XM Cloud PowerShell Receive-File Returning "cancel"
The ‘file.pdf' file cannot be uploaded. File type isn’t allowed.
Start typing to search...
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.
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 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>
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>
image/* in addition to other types./App_Config/Include/zzz.Spe/ and name it zzz.Spe.Custom.config to ensure it loads after the original./sitecore/admin/showconfig.aspx to confirm the patch took effect.Thanks to Jeff and Ryan for helping unravel this. Hopefully, this saves someone else the debugging marathon.