File Uploading

Hi all,

I’m trying to set up an endpoint for uploading files. However, I get the following error:

The MIME type or the Extension of the uploaded file application/msword was not accepted by the server.

I’m figuring its a server setting, but I’m unfamiliar with how commandbox/cfwheels handles running the local server and where I can make changes to it. Any suggestions? I realize there is the server.json, but I don’t see any settings for updating the accepted mime types.

Here is the code for uploading too:

// upload file to temp dir
try {
var tempfile = fileUpload(
} catch (any e) {
throw(e.message, e.errorcode);

Hi Brandon, I’m not sure this is a CommandBox question. What does the getAcceptedMimes() function return? I’m guessing that doesn’t include msword.

getAcceptedMimes() is a CFWheels function to return valid mime types. However, I’m running locally with commandbox and was wondering where and if I can make changes to the server settings, such as the allowed mime types by the server.

Ok, so firstly I’m having this conversation on CFML Slack right now with Tom King (you should really just join Slack) and he claimed that the getAcceptedMimes() function wasn’t part of CFWheels but must have been form your app. Secondly, I’m not sure you’re understanding. This isn’t a server setting at all so far as I know and CommandBox has nothing to do with it. Dump out the result of the getAcceptedMimes() function. I think you’ll find msword is not in there and that is your problem. If that truly is a CFWheels function, then this becomes a CFWheels question to ask how you control the output of that function. The reason CF won’t upload the file is because you’ve told CF that the mime type shouldn’t be accepted!

First of all, my apologies about the confusion around that function. It is obtaining the MIME types from an application variable, application.cfwheels.mimetypes, which is defined at the application level. I’m definitely telling CF the wrong MIME type, so sorry for all the confusion!

Thank you!