Note that there are some explanatory texts on larger screens.

plurals
  1. POUploading .docx using mime types
    primarykey
    data
    text
    <p>I've been using the built-in <code>mimeTypes</code>validator for uploading files through Yii. I can't seem to get .docx files or .rtf files to be accepted though. Currently I have this code:</p> <p><strong>Model</strong></p> <pre><code>array('file', 'file', 'on' =&gt; 'insert', 'safe'=&gt;true, 'maxSize'=&gt; 512000, 'maxFiles'=&gt; 1, 'mimeTypes' =&gt; 'application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, text/rtf, text/plain', 'tooLarge'=&gt; 'File cannot be larger than 500KB.', 'wrongMimeType'=&gt; 'Format must be:&lt;code&gt;.doc&lt;/code&gt; &lt;code&gt;.docx&lt;/code&gt; &lt;code&gt;.txt&lt;/code&gt; &lt;code&gt;.rtf&lt;/code&gt;'), </code></pre> <p>I've added the .docx extension to Yii's mimeTypes.php file with this line:</p> <pre><code>'docx'=&gt;'application/vnd.openxmlformats-officedocument.wordprocessingml.document', </code></pre> <p>I've also added this to my apache/conf/mime.type</p> <pre><code>application/vnd.openxmlformats-officedocument.wordprocessingml.document docx </code></pre> <p>I've also read around on the topic and seen that often these files are regarded as zips and added the mimeType <code>application/octet-stream</code> and <code>application/zip</code> and it still won't upload.</p> <p>I've also echoed out the mime_type Yii is seeing and it matches the settings I have inside the model.</p> <p>I'm just a bit lost on what else and where else to try and fix this. So any help from more experienced people would be great</p> <p>Thanks</p> <p>Jonny</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload