ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Upload file

August 20, 2010 7:30am

Subscribe [6]
  • #16 / Aug 27, 2010 4:42am

    JoostV

    527 posts

    I tested this code and it works in IE8, FF3.6 and Google Chrome, if I upload a Word-file with the extension .doc.

    A few unsollicited pointers:
    - It’s really none of my business, but why would you want to specify ‘allowed_types’ if you’re going to allow all kinds of dangerous files like php and exe anyway? Allowing php files to be uploaded is highly insecure! A user could upload a script that deletes all files in you webroot, or your entire database.
    - You call an undefined variable $upload_error in your view, which throws an error. (Message: Undefined variable: upload_error)
    - Try not to use short open tags, it makes your app less portable

  • #17 / Sep 03, 2010 9:52am

    123wesweat

    107 posts

    might be usefull for some

    I had to add
    ‘application/octetstream’
    for FF/PC

  • #18 / Sep 28, 2011 10:04am

    rip_pit

    88 posts

    for MS Office docx, xlsx, pptx

    i had to add :

    'application/x-zip-compressed'


    in the mimes definitions you gave :

    'docx'    =>    array('application/vnd.openxmlformats-officedocument.wordprocessingml.document','application/x-zip-compressed'),
                    'xlsx'    =>    array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet','application/x-zip-compressed'),
  • #19 / Jan 05, 2012 8:38pm

    elevend

    5 posts

    why i cann’t upload file extensions (.docx, .xlsx, .rar) ?
    but .doc, .txt, .zip it work?

  • #20 / Jan 08, 2012 8:40pm

    rip_pit

    88 posts

    This can be related to “/application/config/mimes.php” config file.
    I solved the problem by adding/modifying 2 rules (see my previos post)

    Try follow this steps :
    Make a copy of your current “application/config/mimes.php” if something wrong occurs then you’ll be able to restore your application.

    - Open “application/config/mimes.php”,
    - If exists “docx” and “xslx” lines, replace them with this code,
    - Else simply append this 2 lines at the end of the existings array :

    'docx'    =>    array('application/vnd.openxmlformats-officedocument.wordprocessingml.document','application/x-zip-compressed'),
    'xlsx'    =>    array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet','application/x-zip-compressed'),

    hope it helps 😉

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases