Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cffile upload error - image/"P"jpeg) 1

Status
Not open for further replies.

leadman

Programmer
Jun 11, 2001
177
US
I almost have my cffile/upload working. It is set to
Code:
accept="image/jpg, image/gif"
. Gifs are uploading fine but when i choose a jpeg (image.jpg) i get the following error:

[tt]The MIME type of the uploaded file (image/pjpeg) was not accepted by the server. Please verify that you are uploading a file of the appropriate type[/tt]

has anyone run into this before?
 
I've run into this when I had corrupt jpegs try it on a few jpegs. Also when uploading the file if using a form to post the file make sure the form has the attribute

enctype="multipart/form-data"

if that does not work include the file type image/jpeg

Also check the obvious that the file you are trying to upload is a jpeg and has not just been given the jpeg extension (i.e. simply giving a gif or another file type .jpg extension wont fool the server).

If none of that works post some code


HTH

Kola
 
I did/checked all of those things but still not working - here is the code (what is a pjpeg anyhow? - photoshop jpeg perhaps? i do use photoshop):

Code:
<cfset pathhere=#GetDirectoryFromPath(GetCurrentTemplatePath())#>

<cfif isDefined(&quot;form.p1&quot;) AND form.p1 EQ &quot;p1&quot;>
<cfoutput>
<cffile action=&quot;upload&quot;
		filefield=&quot;picture1&quot;
		destination=&quot;#pathhere#pic1.jpg&quot;
		nameconflict=&quot;overwrite&quot;
		accept=&quot;image/jpg, image/jpeg, image/gif&quot;>
</cfoutput>
</cfif>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
<table>
<form name=&quot;upload1&quot; method=&quot;post&quot; action=&quot;test.cfm&quot; enctype=&quot;multipart/form-data&quot;>
               <tr><td colspan=&quot;3&quot;>
        <input type=&quot;file&quot; name=&quot;picture1&quot; size=&quot;40&quot;><td>
                </tr><tr> 
                  <td valign=&quot;top&quot;>
        <input type=&quot;hidden&quot; name=&quot;p1&quot; value=&quot;p1&quot;>
        <input type=&quot;submit&quot; name=&quot;Submit2&quot; value=&quot;Submit&quot;>
                  </td></tr>
</form>
</table>
</body>
</html>
 
Hi

I think I've sussed this! I tried your code and got the same error. Looking at the code everything looked fine so I looked at a project where I had done something similar and for some reason I had image/pjpeg in the accept list. In fact every time I had done this I had also had image/pjpeg in the accept list (probaly just copied the same code). Asked my boss and designer what is a pjpeg and no one knows. My guess is that it is the correct mime type (as opposed to file extension) for jpegs.

HTH

Oh and also bear in mind that you dont need cfoutput around the ffile tag, infact you dont need cfoutput around ## when the value is inside a cftag not even in cfquery.

KOla
 
thanks for the feedback - i'll going to add pjpeg to my accept list. I did drum up the meaning of pjpeg, it referres to 'progresive jpeg' - it looks like it came into being couple of years ago, somewhat like the jpeg version of progressive gifs.
 
Thanks for that its good to know. I wonder if this is a bug in the coldfusion server - it may be incorrectly identifying the mime type of jpegs
 
Just to update this thread as no final determination was posted. I had the same problem with image/jpeg. Ran a keyword search, found this post, and changed accept list to image/pjpeg.

Problem solved. Peace
BT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top