title: How do you create a new file in a CarrierWave process?
body: <p>My user uploads a zip file with 3 files (A.ttf, A.svg, A.otf) and I want to store the original zip plus the 3 font files inside it.  I've created the 3 versions with this code</p>
  
  <pre><code>version :ttf
      process :font =&gt; :ttf
  end
  
  version :svg
      process :font =&gt; :svg
  end
  
  version :otf
      process :font =&gt; :otf
  end
  </code></pre>
  
  <p>It successfully saves 4 copies of the original file, all with the proper file name.  However, I don't know how to get CarrierWave to store the individual files.  This code doesn't work.  :(</p>
  
  <pre><code>def font(format)
    new_file = nil
  
    # Loop through the zip file and extract the files
    Zip::ZipFile.open(@file.file) do |files|
      files.each do |f|
        next unless f.file?
  
        filename  = f.name.split("/").last
        ext       = filename.split('.').last
  
        # Save the file with the proper file extension
        new_file = f if ext == format
    end
  
    # Return the file to be stored by CarrierWave
    new_file
  end
  </code></pre>