0

I am using ruby zip for the first time to read files and i keep getting the error file not found. i even tried putting the file in my public directory and i am still getting the exact same error but if i enter the file location im my address bar the file downloads meaning the file exists.

  <% url = URI(request.url) + @design_request.file.url(:original, false) %>
    <% Zip::File.open(url.to_s) do |zip_file| %>
        <% zip_file.each do |entry| %>
            <%= "Extracting #{entry.name}" %>
        <% end %>
    <% end %>

Any help. thanks

Cœur
  • 37,241
  • 25
  • 195
  • 267
Uchenna
  • 4,059
  • 6
  • 40
  • 73
  • 2
    Don't try to read the file over HTTP (`http://my.server.com/my_file.zip`) - read it from your file system (`/home/my_user/my_app/my_file.zip`) – Uri Agassi Dec 10 '14 at 16:08
  • cool. i have changed it and it seems to be working fine. how can i remove the first entry. cos the first entry is invalid. its the rar folder its self. i used index to sort it out hoping there is a better way. – Uchenna Dec 10 '14 at 16:23
  • 1
    `<% next if entry.directory? %>` – Uri Agassi Dec 10 '14 at 16:30

0 Answers0