Skip to main content
Inspiring
November 2, 2008
Answered

cffile:upload - accept - problem

  • November 2, 2008
  • 1 reply
  • 8301 views

Greetings,

My desire is to restrict file uploads to .doc / .pdf / .xls documents.
All seems to be working fine when I upload either .doc or .pdf documents.
However, when I attempt a .xls upload, I get the error message displayed in
my code section <cfcatch></cfcatch> below . I understand what the error
message is indicating, but do not understand why.

I have tried both application/msexcel - and - application/ms-excel and have
received the same error. So perhaps I have the wrong syntax for the excel
component.

Does someone know the correct syntax to use for the excel component?

Is there something else I need to be doing regarding excel files?

Also does someone have a work around for the new microsoft extensions?

Example: docx, xlsx

Thanks in advance for insight to this.

Leonard

- - - My code below - - -

<cftry>

<cffile
action="upload"
destination="C:\path\to\the\folder"
filefield="upload_doc"
nameconflict="overwrite"
accept="application/msword, application/pdf, application/ms-excel">

<cfcatch type="application">

Type - Application

Message - The MIME type of the uploaded file application/vnd.ms-excel was not accepted by the server.

Detail - Only files of type application/msword, application/pdf, application/ms-excel can be uploaded.
Verify that you are uploading a file of the appropriate type.

</cfcatch>

</cftry>
    This topic has been closed for replies.
    Correct answer BKBK
    The correct MIME type for Excel files is indeed application/vnd.ms-excel. That is the value you should use in the accept attribute.

    1 reply

    BKBK
    Community Expert
    BKBKCommunity ExpertCorrect answer
    Community Expert
    November 3, 2008
    The correct MIME type for Excel files is indeed application/vnd.ms-excel. That is the value you should use in the accept attribute.

    Leonard_BAuthor
    Inspiring
    November 3, 2008
    BKBK -

    Thanks I thought that was the correct syntax.

    Now that being established, do you or does anyone else have any
    insight as to why the process (see code above) will not allow an
    excel file to upload?

    Leonard
    Inspiring
    November 3, 2008
    quote:

    Originally posted by: Leonard B
    BKBK -

    Thanks I thought that was the correct syntax.

    Now that being established, do you or does anyone else have any
    insight as to why the process (see code above) will not allow an
    excel file to upload?

    Leonard

    Could it be because what you are attempting is different than what BKBK told you was the correct answer?