title: Codeigniter Multiple File Upload Encryption Issue
body: <p>I've got a big form that allows users to upload multiple files/filetypes to an offer/bid they are creating. Everything is working fine except one piece: the name encryption of the files before saving to the database.</p>
  
  <p>I haven't found a rhyme or reason for it, but it's hit or miss. The image works fine every time. The other documents (which allow all [*] types, but primarily will consist of various business docs such as pdf, doc, xls, etc.) are the ones that are spotty.</p>
  
  <p>I found threads on SO and elsewhere about general issues with the name encryption but have yet to come across one that deals with the specificity of my issue.</p>
  
  <p>Here's the upload function:</p>
  
  <pre><code>//for multi uploads
          function do_uploads($name, $file)
          {
              $status ="";
              $msg = "";
              $file_element_name = $name;
  
  
              //go through and figure out where it goes
              if($name == "QuoteDoc") {
                  $folder = "quotedocs";
                  $allowed = '*';
              }
              else if($name == "ProductOfferPhoto") {
                  $folder = "product_photos";
                  $allowed = 'jpeg|jpg|png|gif';
              }
              else if($name == "ResearchWhtPaper1" || $name == "ResearchWhtPaper2") {
                  $folder = "research";
                  $allowed = "*";
              }
              else if($name == "ProductLiterature1" || $name == "ProductLiterature2") {
                  $folder = "literature";
                  $allowed = "*";
              }
              else if ($name == "FDALink") {
                  $folder = "fda";
                  $allowed = "*";
              }
  
  
              $config['upload_path'] = './uploads/' . $folder;
              $config['allowed_types'] = $allowed;
              $config['max_size']  = 1024 * 8;
              $config['encrypt_name'] = TRUE;
  
              $this-&gt;load-&gt;library('upload', $config);
  
              if ( ! $this-&gt;upload-&gt;do_upload($name))
              {
                  $status = 'error';
                  $msg = $this-&gt;upload-&gt;display_errors('', '');
              }
              else {
                  $data = $this-&gt;upload-&gt;data();
              }
  
              @unlink($_FILES[$file_element_name]);
  
              //what's up?
              //return $this-&gt;upload-&gt;data();
              return array('status' =&gt; $status, 'msg' =&gt; $msg, 'data' =&gt; $this-&gt;upload-&gt;data(), 'allowed'=&gt;$allowed);
          }
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>