I have a simple powershell script that invokes file upload into the context item:

Receive-File -ParentItem (get-item .)

If I try to upload existing file (name of the item exists in the same folder) it should show the warning message. This message is shown if I just use Upload File interface of Content Editor. But in my case, the dialog box is broken and there is a JS error in console:

Uncaught ReferenceError: scForm is not defined

enter image description here

I was not able to find any similar reports but it is reproducible on my local env and on Azure as well. Sitecore XP 10.1.2 (rev. 006578)


2 Answers 2


You can try adding Overwrite option to the receive-file command as below.

Receive-File -ParentItem (get-item .) -Overwrite

Hope it helps.

  • Thing is that I do not need to allow overwrites. I need to show a message to a user that item already exists Commented Mar 26 at 18:05
  • Reason for the error is duplicate file names are prevented on the same level. You can modify the OnLoad method inside Spe.Client.Applications.UploadFile.PowerShellUploadFilePage2 to achieve the same.
    – ckhanna
    Commented Mar 26 at 18:49
  • My issue is not the error, but the broken error popup Commented Mar 26 at 20:55

The issue you are encountering is likely due to a conflict or a missing JavaScript resource within the custom PowerShell script dialog in Sitecore. The error Uncaught ReferenceError: scForm is not defined indicates that the Sitecore form handling JavaScript (scForm) is not being properly loaded or referenced. Here is an example of how you might include the Receive-File command

# Define the parent item
$parentItemPath = "master:/sitecore/content/your/path"
$parentItem = Get-Item -Path $parentItemPath

# Check if the item exists
if ($parentItem -eq $null) {
    Write-Host "Parent item not found at path: $parentItemPath" -ForegroundColor Red

# Invoke the file receive dialog
Receive-File -ParentItem $parentItem -OverwriteIfExists $false -Complete {
    if ($uploadedFile -eq $null) {
        Write-Host "File upload failed or file already exists." -ForegroundColor Yellow
    } else {
        Write-Host "File uploaded successfully: $($uploadedFile.Name)" -ForegroundColor Green

Check JavaScript Console: Inspect the browser console for any additional errors that might give more context to the issue.

Verify SPE Installation: Ensure that the Sitecore PowerShell Extensions are correctly installed and configured in your Sitecore environment.

Hope the above steps resolves your broken popup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.