File upload capabilities in SPE can be restricted by file type and destination path. This provides defense in depth by preventing malicious file uploads even if the upload service is enabled.
File Extensions - Specific extensions like .csv, .txt, .xml
MIME Type Patterns - Wildcards like image/*, text/*, application/json
Configuration Examples
Allow Specific Extensions
Allow MIME Type Categories
Allow Office Documents
Common File Type Patterns
File Type
Extension Pattern
MIME Type Pattern
Images
.jpg, .png, .gif
image/*
Documents
.pdf, .doc, .docx
application/pdf, application/msword
Spreadsheets
.xls, .xlsx, .csv
application/vnd.ms-excel, text/csv
Text Files
.txt, .log
text/plain, text/*
Data Files
.json, .xml
application/json, application/xml
Archives
.zip
application/zip
Security Warning: Be extremely careful allowing executable file types like .exe, .dll, .ps1, .bat, .cmd, .vbs, .js. These can be used to compromise the server.
Upload Location Restrictions
How It Works
SPE restricts where files can be uploaded using path patterns. These paths support Sitecore variables.
Sitecore Path Variables
Variable
Resolves To
Typical Path
$SitecoreDataFolder
Data folder
C:\inetpub\wwwroot\App_Data
$SitecoreLogFolder
Log folder
C:\inetpub\wwwroot\App_Data\logs
$SitecorePackageFolder
Package folder
C:\inetpub\wwwroot\App_Data\packages
$SitecoreTempFolder
Temp folder
C:\inetpub\wwwroot\temp
$SitecoreMediaFolder
Media folder
C:\inetpub\wwwroot\upload
Configuration Examples
Allow Only Temp Folder (Most Secure)
Recommended: Standardize your solution with a folder that you will routinely clean.
Allow Multiple Locations
Dangerous Locations to NEVER Allow
❌ Never allow uploads to these locations:
Complete Configuration Examples
Secure Configuration (Data Import Use Case)
Allow CSV/Excel imports to a dedicated import folder:
Best Practices
Security Recommendations
✅ Do:
Use the principle of least privilege - only allow necessary file types
Restrict uploads to non-web-accessible folders when possible
Use $SitecoreTempFolder as the primary upload location
Create dedicated subdirectories for different upload purposes
Regularly clean up uploaded files
Monitor upload activity
Use both extension AND MIME type patterns for defense in depth
Test your restrictions before deploying to production
<!-- DO NOT DO THIS -->
<allowedLocations>
<path>C:\</path> <!-- Root drive -->
<path>C:\Windows</path> <!-- Windows directory -->
<path>C:\inetpub\wwwroot</path> <!-- Web root (allows direct access) -->
</allowedLocations>
<configuration xmlns:patch="https://www.sitecore.net/xmlconfig/">
<sitecore>
<powershell>
<uploadFile>
<!-- Only allow data file types -->
<allowedFileTypes>
<pattern>.csv</pattern>
<pattern>.xls</pattern>
<pattern>.xlsx</pattern>
<pattern>text/csv</pattern>
<pattern>application/vnd.ms-excel</pattern>
<pattern>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</pattern>
</allowedFileTypes>
<!-- Only allow specific import locations -->
<allowedLocations>
<path>$SitecoreTempFolder</path>
<path>$SitecoreDataFolder\uploads</path>
</allowedLocations>
</uploadFile>
</powershell>
</sitecore>
</configuration>