Rip's Domain

CFFILE upload gotcha with IE and JPG

Posted in ColdFusion by rip747 on May 9, 2007

Short little reminder for myself. For some reason IE sets the content type of a JPG file to image.pjpeg when uploading a JPG file. So make sure to update your cffile upload to accept this file along with image/jpg and image/jpeg. This doesn’t happen in FireFox. The full accept string for JPGs should be: image/jpg,image/jpeg,image/pjpeg.

6 Responses

Subscribe to comments with RSS.

  1. Sam Farmer said, on May 9, 2007 at 7:50 pm

    Thanks for the tip — will implement into our applications.

  2. Doug Hughes said, on May 9, 2007 at 10:15 pm

    pjpeg == progressive jpeg

  3. Kevin said, on May 24, 2007 at 10:21 am

    Any ideas on how to get IE to pass a jpg to the program configured to display a jpg based on file extension instead of always showing them in the browser when I stream a file out using

    When I send it as an attachment, it will open in the correct program, but will ask the open or save question.
    I also notice that when I send it as an attachment, the open/save dialog says it is an unknown file type.

  4. Kevin said, on May 24, 2007 at 10:22 am

    Sorry, it stripped the tags I sent, the code was without the tags.

    cfheader name=”Content-Disposition” value = “inline;filename=thefile.jpg”
    cfcontent type=”image/jpg” variable=”imageBinary”

  5. rip747 said, on May 24, 2007 at 1:46 pm

    @Kevin
    Don’t really know, but try this:
    <cfheader name=”Content-Disposition” value=”attachment;filename=memberlist.xls”>
    <cfcontent type=”application/octet-stream” file=”#FullFileName#” deletefile=”true” reset=”true”>
    I use this so that the browser will prompt them for a program to use to open the file. Notice the application/octet-stream, which is generic.

  6. Kevin said, on May 25, 2007 at 10:27 am

    We use the attachment method when we are launching one file at a time and that works fine, but we have a page that allows them to select a bunch of images to download to image pro and it gets pretty annoying to get all the open/save dialogs. The problem isn’t just within coldfusion, if I do a simple window.open in javascript, it too goes to the browser instead of to the program based on the file extension. Yet, it works fine for .tif files.


Leave a comment