Why my.photo (final).jpg fails portal security filters with Invalid File Format even when it is a real JPEG

How naive first-dot extension parsers and Web Application Firewall regex filters block filenames with extra dots, brackets, and spaces.

Imagine checking your passport photograph three times: it is a genuine JPEG, its dimensions are an exact 200 × 230 pixels, and its file size is a safe 34,200 bytes—well inside the 20 KB to 50 KB requirement. Yet the moment you select it on the recruitment portal, a red error banner flashes: "Invalid File Format! Only JPG/JPEG allowed" or "Special characters not allowed in file name." You open the image on your laptop and confirm it is definitely a .jpg. Why is the portal lying about the format?

The answer lies in how legacy backend scripts and Web Application Firewalls (WAFs) on government servers inspect incoming uploads. Before inspecting the binary image data, a portal’s validation code first examines the filename string sent in the HTTP request header. To block hackers from uploading executable scripts disguised with double extensions—such as shell.php.jpg or exploit.asp.pdf—many government portals reject *any* filename that contains more than one dot, or they naively read whatever comes immediately after the *first* dot as the file extension.

When you upload a file named rahul.kr.sharma.jpg, a naive script splits the string at the first dot, concludes that the file extension is .kr, and throws an "Invalid File Format" error. Similarly, Windows duplicate suffixes like photo (1).jpg or WhatsApp’s default export names contain spaces, parentheses, and multiple dots that trip strict security filters. This guide breaks down the exact filename rules used by recruitment portals and shows how a five-second rename prevents false format rejections.

Quick answer & key takeaways

Many government recruitment portals validate file formats by splitting the filename at the first period (.) rather than the last one, or by running a strict regular-expression firewall filter against the filename string. As a result, a valid JPEG named my.photo (final).jpg or WhatsApp Image 2026-10-19 at 4.15.02 PM.jpeg gets rejected as an "Invalid File Format" or "Malicious File" before the server ever checks the image itself.

  • Naive portal scripts that split filenames at the first period (.) read rahul.sharma.jpg as having a .sharma extension and reject it as an invalid file format.
  • Web Application Firewalls (WAFs) on NIC, PSU, and banking portals actively block filenames containing double dots (..), parentheses (1), ampersands (&), apostrophes ('), and quotes to prevent path-traversal and SQL/command injection attacks.
  • Default filenames generated by WhatsApp (WhatsApp Image 2026-10-19 at 14.22.10.jpeg) and Windows duplicate downloads (signature (2).jpg) are the number-one source of false format rejections.
  • Some older state portals are even case-sensitive on extensions, accepting lowercase .jpg and .pdf while rejecting uppercase .JPG or four-letter .jpeg strings.
  • Using a strict lowercase alphanumeric naming habit—like photo.jpg, sign.jpg, and caste.pdf—eliminates 100% of filename-based security rejections across every exam board.

The "First Dot" bug and double-extension security blocks

In web security, one of the oldest server attacks is the "double extension" exploit, where an attacker uploads a file named invoice.php.jpg hoping that an improperly configured Apache or IIS server will execute the .php code. Because recruitment portals handle millions of public file uploads from unauthenticated users, government cybersecurity auditors require strict countermeasures against double extensions.

Instead of parsing only the final extension safely and renaming the file on the server, many portal scripts implement one of two blunt rules: either they reject any filename where the count of period characters (.) is greater than one, or they run filename.split(".")[1] to grab the extension. Under both methods, completely innocent candidate filenames fail immediately.

How a legacy portal parser misreads real candidate filenames
Your actual filename on diskWhat a naive portal parser seesError message shown to youSafe renamed version
r.k.verma.photo.jpgExtension parsed after first dot as .k (or blocked for 4 dots)Invalid file type. Only JPG/JPEG allowed.photo.jpg
WhatsApp Image 2026-08-14 at 10.30.45 AM.jpegContains 3 dots (.30.45.jpeg), 6 spaces, and a 4-letter .jpeg extensionInvalid file format / File name is too longphoto.jpg
signature (1).jpgParentheses ( and ) flagged by WAF regex filter ^[a-zA-Z0-9_-]+\.(jpg|jpeg)$Special characters not allowed in file namesign.jpg
10th_marksheet_&_passing_cert.pdfAmpersand & breaks unescaped XML/HTML parameter parsing on the serverUpload failed / Server Error 500class10.pdf
IMG_4092.JPGUppercase .JPG fails case-sensitive string comparison ext === "jpg"Please select a valid .jpg filephoto.jpg

How WhatsApp, Windows, and mobile scanners create illegal filenames automatically

Very few candidates intentionally type special characters into their filenames. Instead, the operating system or scanning app inserts them behind the scenes. The most notorious offender in India is WhatsApp: when you photograph your signature on your phone, send it to yourself on WhatsApp Web to get it onto your laptop, and click Download, WhatsApp saves the file as WhatsApp Image 2026-10-19 at 18.42.11.jpeg. That single default filename violates three portal rules at once: it has multiple periods in the timestamp (18.42.11), multiple spaces, and a .jpeg extension that 3-character validators reject.

The second major trap happens inside your browser’s Downloads folder. Suppose you compress your photo once, saving photo.jpg. Five minutes later you tweak the crop and download it again into the same folder. Windows, macOS, and Android automatically rename the second download to photo (1).jpg or photo(1).jpg so it does not overwrite the first file. Those parentheses (1) are outside the alphanumeric whitelist of strict portals.

  • Mobile scanner app timestamps: Apps like Adobe Scan, CamScanner, and Microsoft Lens often default to names like Scan 19 Oct 2026 (2).pdf or Doc_19.10.2026.pdf, introducing spaces, brackets, and date dots.
  • Candidate name initials: Candidates who dutifully name their files after their official initials—such as S.Subramanian_OBC.pdf—inadvertently introduce a period right after the first letter.
  • Long descriptive paths: Some state treasury and recruitment databases store the uploaded filename in a VARCHAR(30) database column. A 48-character filename gets truncated mid-extension in the database, corrupting the link to your photo on your admit card.

The `.jpg` vs `.jpeg` vs `.JPG` extension mismatch

Technically, .jpg, .jpeg, .JPG, and .JPEG all refer to the exact same ISO/IEC 10918-1 Joint Photographic Experts Group image format. Inside the file, the binary bytes are identical. However, in poorly written client-side JavaScript validators, checking the extension is often done with a literal string comparison rather than a case-insensitive list.

For example, DSLR cameras and many iPhones save images with an uppercase .JPG extension, while WhatsApp and certain Android galleries save with a four-letter .jpeg extension. If a portal’s file input is coded with a strict check like fileName.endsWith(".jpg"), both .JPG and .jpeg fail instantly. Standardising every image upload to lowercase three-letter .jpg and every document upload to lowercase .pdf is the safest universal rule.

The hidden Windows extension trap that creates `photo.jpg.jpg`

There is one mistake candidates make while *trying* to fix their filename that actually creates a double-extension error. By default, Windows 10 and Windows 11 hide known file extensions in File Explorer (Hide extensions for known file types is checked). That means a file whose real name on disk is photo.jpg is displayed in your folder window simply as photo.

If a candidate right-clicks that file, selects Rename, and types photo.jpg into the box, Windows appends that text in front of the hidden extension—turning the real filename on disk into photo.jpg.jpg! When you select it in the exam portal, the portal sees two dots and rejects it.

  1. On Windows 11: Open File Explorer, click View in the top toolbar, hover over Show, and make sure File name extensions has a checkmark next to it.
  2. On Windows 10: Open File Explorer, click the View tab on the top ribbon, and tick the File name extensions checkbox on the right side.
  3. Verify the true full name: Once enabled, check that your file reads photo.jpg with only one dot before the final jpg—never photo.jpg.jpg or photo.jpg.png.

A universal 8-character naming standard that passes every portal in India

You never need to guess which characters a specific recruitment board’s firewall permits if you adopt a strict "8-character lowercase alphanumeric" rule for the files you actually upload. Even if you use detailed names like photo_200x230_45KB.jpg inside your master archive folder to stay organised, make it a habit to rename the final copy inside your per-exam submission folder to a single lowercase word.

Recommended final upload filenames for zero firewall or regex rejections
Document slotRecommended upload filenameCharacters usedWhy it passes every validator
Candidate Photographphoto.jpg5 letters + .jpgZero spaces, zero underscores, single dot, lowercase 3-letter ext
Candidate Signaturesign.jpg4 letters + .jpgShort enough for legacy 12-char DB columns, pure ASCII
Left Thumb Impressionthumb.jpg5 letters + .jpgUnambiguous, passes strictest [a-z]+\.jpg regex
Handwritten Declarationdecl.jpg4 letters + .jpgAvoids spaces or hyphens in "handwritten_declaration"
Class 10 / DOB Certificateclass10.pdf7 alphanumeric + .pdfAvoids 10th superscripts or slashes like 10th/matric
Category / OBC / EWS / SC / STcaste.pdf5 letters + .pdfAvoids hyphens in obc-ncl or slashes in sc/st

Before uploading, drop your final renamed files into the Application file checker. The checker inspects both the filename structure and the internal binary magic bytes (FF D8 FF for JPEG, %PDF- for PDF), giving you complete confidence that neither the filename filter nor the binary parser will reject your submission.

How to sanitise a rejected file so it passes portal filename and format checks

  1. Enable visible file extensions on your computer

    In Windows File Explorer, go to View -> Show -> File name extensions so you can see the true extension of every file. This prevents accidentally naming a file photo.jpg.jpg or overlooking a .jpeg or .png suffix.

  2. Inspect the true binary format in Application File Checker

    Open Application file checker and drop the rejected file in. Confirm whether the internal magic bytes are genuinely JPEG or PDF. If the file is actually a PNG, WebP, or HEIC disguised with a .jpg extension, renaming alone will not fix it.

  3. Re-encode if dimensions, bytes, or format need correction

    If the checker reports a non-JPEG format, wrong pixel dimensions, or a byte count over the decimal KB cap, load the original into the Photo & Signature tool (Photo & signature) or PDF Compressor (PDF compressor) and export a fresh copy.

  4. Rename using only lowercase letters and a single period

    Save or rename the final file in a local folder using a single lowercase word such as photo.jpg, sign.jpg, thumb.jpg, or caste.pdf. Strip out all spaces, initials with dots, brackets like (1), hyphens, and ampersands.

  5. Upload the freshly renamed file directly from your local folder

    Return to the recruitment portal, click Choose File / Browse, select your clean photo.jpg or sign.jpg file, and click Upload. The file will pass both the first-dot extension parser and the Web Application Firewall regex.

Common mistakes to avoid

What goes wrong: Uploading a file directly after downloading it from WhatsApp Web without changing its default timestamped filename.

Better approach: Always rename WhatsApp downloads from WhatsApp Image 2026...jpeg to photo.jpg and re-encode them in Photo & signature to ensure compliant dimensions and baseline JPEG headers.

What goes wrong: Re-downloading a compressed file into the same Downloads folder so Windows adds (1) or (2) to the name.

Better approach: Delete old drafts or save the final file into a dedicated exam folder as photo.jpg with no bracketed numbers.

What goes wrong: Typing .jpg during a rename when Windows has file extensions hidden, resulting in photo.jpg.jpg.

Better approach: Turn on "File name extensions" in Windows File Explorer View settings so you always see the full filename including its single extension.

What goes wrong: Using initials with periods in document names, such as A.P.Sharma_EWS.pdf.

Better approach: Keep candidate names out of the filename if they contain dots or spaces, or write them without punctuation like apsharma.pdf or simply ews.pdf.

Frequently asked questions

Why does the portal say "Invalid File Format" when the real problem is a space or bracket in the filename?

Many recruitment portals combine their filename character check and their extension check into a single validation function—for example, matching the filename against the regular expression ^[a-zA-Z0-9]+\.(jpg|jpeg)$. When a filename like photo (1).jpg fails that pattern because of the space and brackets, the script triggers its single default error message: "Invalid file format."

Are underscores (`_`) and hyphens (`-`) safe in exam portal filenames?

Most modern portals accept underscores and hyphens, such as passport_photo.jpg. However, a small number of strict state university and municipal recruitment portals use an alphanumeric-only regex (^[a-zA-Z0-9]+\.jpg$) that even rejects underscores. Using a single word like photo.jpg or class10.pdf is 100% immune to that restriction.

Does changing the filename extension from `.jpeg` to `.jpg` corrupt the image?

If the file is already a genuine JPEG image, changing its four-letter .jpeg extension to the three-letter .jpg extension does not alter or corrupt the image data at all—both extensions represent the exact same file format. However, changing .png, .webp, or .heic to .jpg without re-encoding *will* fail binary inspection.

What if the official notification specifically asks me to name the file with my Roll Number or Registration ID?

Always follow the notification’s explicit naming instruction if one is given—for example, 10293847_photo.jpg or 10293847.pdf. Just make sure you do not add any extra spaces, brackets, or duplicate dots around the required format.

Can a long folder name on my laptop cause a filename error on the portal?

No. Because modern browsers mask your folder path as C:\fakepath\ and only transmit the filename itself (photo.jpg) in the HTTP upload header, the names of the folders on your computer do not affect the portal—only the name of the file itself matters.

Summary

A valid photograph or PDF should never be rejected just because Windows added (1) to the end of its name or because you put dots between your initials. Yet legacy extension parsers and strict firewall rules on government portals reject multi-dot and special-character filenames every day. Make it a habit to verify your files in the local Application File Checker and rename every final upload to a short, single-dot lowercase word like photo.jpg, sign.jpg, or caste.pdf. That simple step removes an entire category of mysterious portal errors.

Related guides

Browse all guides →