Why file picking and saving failed on iPhone Safari, and how we fixed it
Our site has tools like a PDF merger and an image converter that process files entirely in the browser, without uploading them. Pick a file, process it, save the result. That's all, but on iPhone Safari we tripped over both the picking and the saving.
These are the bugs we fixed on the night of June 29, 2026 and on July 6, in the order they appeared. If file inputs or downloads work on desktop but not on iPhone, this may help. What we say about iPhone behavior is what we confirmed in June–July 2026; iOS updates can change it, so check on a real device.
Timeline
The first report: on iPhone Safari, you couldn't add a second file to the PDF merger. Then, one fix after another, file picking worked but saving didn't, then a save bar appeared but tapping it didn't save. On June 29 alone we shipped five fixes in about an hour.
| Fixed | Problem | Fix |
|---|---|---|
| 6/29 21:00 | Can't add a second file to the PDF merger on iPhone | Changed the hidden file input from display:none to "invisible but rendered", and also added pointer-events: none |
| 6/29 21:25 | Because of that pointer-events: none, the file picker never opened at all | Removed pointer-events. Concluded the cause was calling click() on a display:none input |
| 6/29 21:32 | Automatic save after processing is ignored on iPhone | On iPhone, show a "Save" bar at the bottom to tap |
| 6/29 21:51 | Tapping the bar's link still doesn't save | Open the share sheet (Web Share API) and save with "Save to Files" |
| 6/29 21:59 | Two tools that opened the picker with their own code had the same problem | Moved "invisible but rendered" into a shared function and used it there too |
| 7/6 | "Save all" on iPhone saves only the last file | The save bar now stacks one row per file |
| 7/6 | The "Download" in our image↔Base64 tool, on the Base64-to-image side, didn't actually save (not only on iPhone) | Route it through the shared save helper (downloadBlob) |
At the end of June 29 (22:01), we wrote the lessons down as a working rule: file inputs and downloads always go through the shared helpers. On July 6 we added a machine check that enforces the rule before release.
1. The file picker won't open: display:none and click()
The common pattern
File picking uses the browser's <input type="file">. Its button is hard to style, so a common pattern is to hide the input and call input.click() from JavaScript when your own "drop files here" area is clicked. We did that too, with the hidden attribute (same as display:none). It worked on desktop. Not on iPhone Safari.
The first fix made it worse
Since the report was "can't add a second file", we guessed that a display:none input sometimes doesn't fire change on later picks. So we made the input 1px, transparent and behind everything: invisible, but rendered.
To keep the transparent input from intercepting taps, we also added pointer-events: none. That was the mistake. Now the picker didn't open at all.
We added temporary diagnostic logging to the PDF merger to narrow it down, then removed it. Within what we confirmed, two things were happening:
- On iPhone Safari, calling click() from JavaScript on a display:none (hidden) input doesn't open the picker
- Calling click() on an input with pointer-events: none doesn't open the picker
Honestly, we never fully pinned down why the first file worked and the second didn't in the original report. But with the setup below, first and later picks all open.
The fix: invisible, but still rendered
We put the hiding into a shared function, revealFileInputForIOS, named for what it does: bring the input out for iOS.
export function revealFileInputForIOS(input) {
input.removeAttribute('hidden'); // no more display:none
input.style.position = 'fixed';
input.style.left = '0';
input.style.top = '0';
input.style.width = '1px';
input.style.height = '1px';
input.style.opacity = '0'; // invisible, but still rendered
input.style.zIndex = '-1';
// no pointer-events: none (with it, the file picker stopped opening)
}
Two points: no display:none, and no pointer-events: none. It's transparent and behind everything, so it affects neither looks nor taps. The function that connects the drop area to the input (setupDropzone) calls it first, then wires up click():
export function setupDropzone(zone, input, onFiles) {
revealFileInputForIOS(input);
zone.addEventListener('click', () => input.click());
input.addEventListener('change', () => {
if (input.files?.length) onFiles([...input.files]);
input.value = ''; // so picking the same file again still fires change
});
// also handles keyboard (Enter, Space) and drag and drop
} Picking the same file twice: input.value = ''
The input.value = '' above handles a separate pitfall. Browsers fire change only when the value changes. Pick a.pdf, then pick a.pdf again, and nothing changed, so nothing seems to happen. Clearing the input right after reading the files fixes it. The July 6 review found this line missing in two tools that didn't use the shared helper (a hash generator and the image↔Base64 tool), so we added it.
The same bug in tools that skipped the shared helper
At the end of June 29, reviewing every tool's file picking turned up two more (a CSV↔JSON converter and the image↔Base64 tool) that called click() on their own hidden inputs. Same bug, same fix. Fixing one place doesn't help while the same pattern lives elsewhere, which led to the rule and the machine check.
2. Automatic save after processing is ignored
What happened
In the PDF merger, pressing "Merge" builds the PDF in the browser and starts a download when done, by creating a hidden <a download> and calling click(). A common pattern.
On desktop it saves. On iPhone Safari, nothing happened. Our understanding: building the PDF takes time, so we await it, and a click() after an await is no longer treated as a user action, so the download is blocked. The "momentum" of the tap runs out while waiting.
The fix: a "Save" bar on iPhone
If it can't save automatically, ask for one more tap. Only on iPhone, a bar at the bottom says "📥 Save filename". A tap is a fresh user action, so it isn't blocked. Desktop saves automatically as before.
export function downloadBlob(blob, filename) {
const url = /* make a temporary URL from the blob */;
const isIOS =
/iPad|iPhone|iPod/.test(navigator.userAgent) ||
(navigator.maxTouchPoints > 1 && /Macintosh/.test(navigator.userAgent));
if (isIOS) {
showManualDownload(blob, url, filename); // show a "Save" bar at the bottom
return;
}
// Desktop etc.: save automatically, as before
const a = document.createElement('a');
a.href = url;
a.download = filename;
document.body.appendChild(a);
a.click();
a.remove();
} (Key parts only. The real code waits a moment for desktop downloads to start before revoking the temporary URL.)
We detect iPhone by user agent. iPad Safari identifies as a Mac by default, so "says Mac but has 2+ touch points" is treated the same. This relies on the user agent, so it isn't perfect, and may need revisiting if iOS changes how it identifies itself.
3. Tapping doesn't save: the download attribute on blob links
The bar still didn't save
The bar's link pointed at a temporary blob: URL for the file built in the browser, with download="filename". On desktop that means "save with this name". Within what we confirmed, iPhone Safari ignored the download attribute on blob links, and tapping didn't save.
The fix: "Save to Files" from the share sheet
The most direct way to hand a file out of the browser on iPhone is the share sheet, which has "Save to Files". A page can open it with the Web Share API (navigator.share). Tapping the bar's link now passes the file to the share sheet:
link.addEventListener('click', async (e) => {
const file = new File([blob], filename, {
type: blob.type || 'application/octet-stream',
});
// If the share sheet can take files, let the user "Save to Files" from it
if (navigator.canShare && navigator.canShare({ files: [file] }) && navigator.share) {
e.preventDefault();
try {
await navigator.share({ files: [file], title: filename });
removeRow(); // saved: remove this row
} catch {
// cancelled: keep the row so they can tap again
}
return;
}
// No file sharing: open in a new tab and save from the viewer's share button
e.preventDefault();
window.open(url, '_blank');
}); Where files can't be shared, it opens the file in a new tab; PDFs and images show in Safari's viewer, which has its own share button. If the share sheet is cancelled, the bar stays so you can tap again.
To be honest, this is one step more than on desktop: process, tap "Save" on the bar, choose "Save to Files", pick a location. Still far better than not being able to save.
4. "Save all" keeps only the last file (July 6)
A week after the June 29 fixes, we reviewed every page for bugs. We build this site with AI, so we had AI split into five teams to inspect all pages, then had another AI argue against each candidate to confirm it was real. Ten bugs were confirmed, two of them about saving.
The first was iPhone-only. Our image converter and image resizer have "Save all", which calls the save helper (downloadBlob) for each file with a short delay between them.
On desktop each file saves automatically. On iPhone, each call shows a bar, and the bar code removed the previous bar before making a new one. Saving five images: bar 2 removed bar 1, bar 3 removed bar 2, and so on. Only the last bar remained.
// Before: every bar removed the previous one and built a new one
document.getElementById('manual-dl-bar')?.remove();
const bar = document.createElement('div');
// ...put a single link in and show it Now there's one bar with a row per file:
// After: one bar (container), one row per file
let container = document.getElementById('manual-dl-bar');
if (!container) {
container = document.createElement('div');
container.id = 'manual-dl-bar';
document.body.appendChild(container);
}
const row = document.createElement('div');
// ...put a "Save" link and a close button in row
container.appendChild(row); Saved or dismissed rows are removed individually, and the bar disappears when it's empty. The cause: when we built the bar, we only thought about one file at a time. Single-file saves never exposed it, so we didn't notice until it met "Save all".
5. "Download" that wasn't saving (July 6)
The second wasn't iPhone-specific. Our image↔Base64 tool can turn a Base64 string (a data URI) back into an image, show it, and download it. The download looked like this:
<a id="downloadBtn" hidden>Download image</a>
// once the image displayed, the link pointed straight at the data URI
downloadBtn.href = dataUri; // no download attribute With no download attribute, clicking navigates to the data URI instead of saving. And major browsers like Chrome now block top-level navigation to data: URLs for security. So this "Download" didn't work as a save button. The review's conclusion: it couldn't save in any environment.
The fix was to put it on the same path as every other tool: the link became a button that converts the data URI back to a Blob and hands it to the shared save helper. Now it behaves like the rest: automatic on desktop, bar and share sheet on iPhone.
<button type="button" id="downloadBtn" hidden>Download image</button>
downloadBtn.onclick = () => {
// decode the data URI's Base64 part to bytes and make a Blob
const byteStr = atob(pendingDataUri.split(',')[1] ?? '');
const arr = new Uint8Array(byteStr.length);
for (let i = 0; i < byteStr.length; i++) arr[i] = byteStr.charCodeAt(i);
const blob = new Blob([arr], { type: pendingMime });
downloadBlob(blob, 'decoded.' + ext); // leave saving to the shared helper
}; 6. Making sure it doesn't happen again
Make it a rule
All these bugs share one thing: they happened where code was written on the spot instead of going through the shared helpers. So our working rules say (written June 29, extended July 6):
- File picking uses
setupDropzone. If you open the picker yourself, go throughrevealFileInputForIOSbefore click() - Never put
pointer-events: noneon the input - Reset with
input.value = ''after reading the files - Downloads go through
downloadBlob. No hand-made blob URLs with a.click(), and no saving via links without a download attribute or via data URI links
AI writes almost all our tools and pages. Keeping the rules in its standing instructions makes new tools take the same path. As of October 23, 2026, 5 tools use setupDropzone, 2 use revealFileInputForIOS directly, and 9 save with downloadBlob.
Check by machine before release
Written rules get skipped, by AI and people alike. So on July 6 we added the download rule to the check that runs automatically before every push:
// Find lines in src/pages .astro files that call URL.createObjectURL directly
// (downloads must go through downloadBlob. Legitimate uses such as image previews
// pass if the line has "audit-allow: <reason>")
const dlRe = /URL\.createObjectURL\s*\(/; Any page file calling URL.createObjectURL directly fails the check and blocks the push. Legitimate non-download uses like image previews pass only with an "audit-allow: reason" comment on that line; there's no way through without a reason. When we added it, we planted a violation on purpose to confirm it stops.
This check only looks for blob URLs made directly. It doesn't catch "saving through a link without a download attribute" (the shape of bug 5). That still relies on the rules and reviews.
Summary: picking and saving files on iPhone
| Goal | Didn't work on iPhone | What we do now |
|---|---|---|
| Open the picker from your own drop area | click() on a hidden (display:none) input | click() on a 1px, transparent input placed behind |
| Keep the transparent input out of the way | pointer-events: none | Don't; just place it behind |
| Pick the same file again | Leave the input as is | input.value = '' after reading |
| Save after processing | a.click() after an await | On iPhone, a "Save" bar to tap |
| Save on tap | download attribute on a blob URL | "Save to Files" via the share sheet (navigator.share) |
| Save several files | Rebuild the bar for each save | One bar, one row per file |
| Save an image decoded from Base64 | Data URI in a link with no download attribute | Convert to a Blob and use the shared save helper |
Looking back, every one was a place where "it works on desktop" felt like enough. Browser-only tools have no server, so getting files in and out has to work within the browser's rules, and on iPhone those rules are a bit stricter.
On iPhone it now takes one more step than on desktop. But every tool picks and saves files the same way, because the logic lives in one shared place and a check stops anything that strays from it.
Nandemo Factory is a one-person studio in Japan that makes small browser games, with AI doing most of the work. We only write about things we built and checked ourselves, with the numbers we actually saw. Play the games in English.