How to Handle Optional File Uploads in Power Automate for Microsoft Forms
Question details
The user needs a reliable way to process optional file uploads from Microsoft Forms in Power Automate without the flow failing due to null values.

- Product
- Power Automate, Microsoft Forms
- Device & OS
- not provided
- Scenario
- Creating a Power Automate flow triggered by a Microsoft Forms submission that includes an optional file-upload question.
- Observed behavior
- The flow fails when a Switch action attempts to process null file content because the respondent left the optional file-upload question empty.
Ensure you have access to edit your Power Automate flow and that your Microsoft Forms trigger is actively capturing form responses.
Replace the Switch Action with a Condition Action
Use a Condition action to evaluate whether the file upload field is empty or null before attempting to process the file content, effectively preventing flow failures.
A Switch action expects a definitive value to evaluate against its configured cases. When an optional file upload is skipped in Microsoft Forms, the output is null, which causes the Switch action to fail. By implementing a Condition action instead, you can safely branch your flow based on whether a file exists.
Open your flow in Power Automate, go to 'Edit' mode, and find the Switch action that is currently handling the file upload processing.
Click the three dots (More commands) on the Switch action and select 'Delete' to remove it from your flow.
Click 'New step', search for 'Condition', and add it to the flow where the Switch action used to be.
In the Condition block, select the dynamic content for your Microsoft Forms file upload in the first field. Set the operator to 'is not equal to', and in the second field, type the expression 'null'.
In the 'If yes' branch (meaning a file was uploaded), add your normal file processing steps. Leave the 'If no' branch empty or add alternative steps for when no file is submitted.

Looking for a simpler way to manage forms and documents?
While Power Automate requires complex logic to handle basic form scenarios, WPS Office offers a streamlined suite for managing your documents, data, and PDFs without the steep learning curve. It is fully compatible with Microsoft Office formats and provides robust tools for everyday productivity.

Frequently Asked Questions
Why does a Switch action fail with empty file uploads in Power Automate?
A Switch action requires a specific value to match against its defined cases. When a user leaves an optional file upload empty in Microsoft Forms, the returned value is null. The Switch action cannot process null values, which results in a flow failure.
How do I use expressions to check for null values in Power Automate?
You can use the 'empty()' expression in a Condition action. By configuring the condition as `empty(outputs('Get_response_details')?['body/YourFileField'])` is equal to 'true', you can accurately branch your flow based on whether data exists.
Can I prevent null file errors directly in Microsoft Forms?
Yes. If your process absolutely requires a file, you can toggle the 'Required' setting on the file upload question in Microsoft Forms. This ensures the flow will always receive a file, completely bypassing the null value issue.




