Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 762515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T16:24:27+00:00 2026-05-14T16:24:27+00:00

I have created a helper that requires some parameters and should upload a file,

  • 0

I have created a helper that requires some parameters and should upload a file, the function works for images however not for zip files. I searched on google and even added a MY_upload.php -> http://codeigniter.com/bug_tracker/bug/6780/

however I still have the problem so I used print_r to display the array of the uploaded files, the image is fine however the zip array is empty:

Array
(
    [file_name] => 
    [file_type] => 
    [file_path] => 
    [full_path] => 
    [raw_name] => 
    [orig_name] => 
    [file_ext] => 
    [file_size] => 
    [is_image] => 
    [image_width] => 
    [image_height] => 
    [image_type] => 
    [image_size_str] => 
)

Array
(
    [file_name] => 2385b959279b5e3cd451fee54273512c.png
    [file_type] => image/png
    [file_path] => I:/wamp/www/e-commerce/sources/images/
    [full_path] => I:/wamp/www/e-commerce/sources/images/2385b959279b5e3cd451fee54273512c.png
    [raw_name] => 2385b959279b5e3cd451fee54273512c
    [orig_name] => 1269770869_Art_Artdesigner.lv_.png
    [file_ext] => .png
    [file_size] => 15.43
    [is_image] => 1
    [image_width] => 113
    [image_height] => 128
    [image_type] => png
    [image_size_str] => width="113" height="128"
)

this is the function helper

function multiple_upload($name = 'userfile', $upload_dir = 'sources/images/', $allowed_types = 'gif|jpg|jpeg|jpe|png', $size)
    {
        $CI =& get_instance();

        $config['upload_path']   = realpath($upload_dir);
        $config['allowed_types'] = $allowed_types;
        $config['max_size']      = $size;
        $config['overwrite']     = FALSE;
        $config['encrypt_name']  = TRUE;

            $ffiles = $CI->upload->data();

            echo "<pre>";
            print_r($ffiles);
            echo "</pre>";
            $CI->upload->initialize($config);
            $errors = FALSE;

            if(!$CI->upload->do_upload($name))://I believe this is causing the problem but I'm new to codeigniter so no idea where to look for errors
                $errors = TRUE;
            else:
                // Build a file array from all uploaded files
                $files = $CI->upload->data();
            endif;


            // There was errors, we have to delete the uploaded files
            if($errors):                   
                @unlink($files['full_path']);
                return false;
            else:
                return $files;
            endif;

    }//end of multiple_upload()

and this is the code in my controller

if(!$s_thumb = multiple_upload('small_thumb', 'sources/images/', 'gif|jpg|jpeg|jpe|png', 1024)): //http://www.matisse.net/bitcalc/
    $data['feedback'] = '<div class="error">Could not upload the small thumbnail!</div>';
    $error = TRUE;
endif;
if(!$main_file = multiple_upload('main_file', 'sources/items/', 'zip', 307200)):
    $data['feedback'] = '<div class="error">Could not upload the main file!</div>';
    $error = TRUE;
endif;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T16:24:28+00:00Added an answer on May 14, 2026 at 4:24 pm

    found the solution -> codeigniter.com/forums/viewthread/149027 Adding force-download to the allowed mime types

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created some JQuery that will expand a div 'popup' on hover and
I have created a function that shows/hides different messages according to a combination of
I have created a helper to parse time froma webservice and output inanother format
I have created an android application that calls (using kSOAP library) a SOAP based
Using information from some of the questions here on generic views, I have created
I have several classes that need to load some properties files, and I was
I have a PHP script (fetchData.php) that fetches some data and outputs it to
I have a list view class that just like NSCollectionView requires an additional prototype
I have a stored procedure for creating inventory transactions that requires the assembly of
I've created a very simple helper class that I can use in my ASP.Net

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.