Sha256: b1c17eaa0ffbf676cceb119e06e3ffc9e342aac109237d9e5fd5bbda2ce81524
Contents?: true
Size: 796 Bytes
Versions: 7
Compression:
Stored size: 796 Bytes
Contents
NAME upload_cache.rb DESCRIPTION a small utility library to facility caching http file uploads between form validation failures. designed for rails, but usable anywhere. USAGE in the controller def upload @upload_cache = UploadCache.for(params, :upload) @record = Model.new(params) if request.get? render and return end if request.post? @record.save! @upload_cache.clear! end end in the view <input type='file' name='upload /> <%= @upload_cache.hidden %> <!-- optionally, you can show any uploaded upload --> <% if url = @upload_cache.url %> you already uploaded: <img src='<%= raw url %>' /> <% end %> in a rake task UploadCache.clear! ### nuke old files once per day
Version data entries
7 entries across 7 versions & 1 rubygems
Version | Path |
---|---|
upload_cache-2.2.0 | README |
upload_cache-1.4.1 | README |
upload_cache-1.4.0 | README |
upload_cache-1.3.0 | README |
upload_cache-1.2.1 | README |
upload_cache-1.2.0 | README |
upload_cache-1.0.0 | README |