Displaying 20 results from an estimated 10000 matches similar to: "The Rails way to download a file..."
2006 Jan 09
6
Rendering dynamic Gruff image (send_data)
Dears,
Got a controller witch do a send_data for displaying a chart.
like :
send_data(g.to_blob, :filename => "any.png", :type => ''image/png'',
:disposition=> ''inline'')
I actually do a
<img src="http://myhost:3000/stats/make_graph" />
Is there any way more clean to do that ? At minima don''t hardcode the
beginning
2006 Apr 20
3
How to restrict access to images by user?
Hi,
I have a some image files that belongs to some users. Only the owner of an
image should be able to see it.
How can I do that?
I don''t think I can use send_data, because I want the image to be displayed
on a "rendered" page. I don''t think I can place the images in the public
folder, because if some user can figure out the name of the image then he''ll
be
2005 Mar 08
3
Extracting images from a DB
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I would like to extract an image BLOB from my database and display it
alongside some other information on my ''edit'' page. I read the
information here
http://wiki.rubyonrails.com/rails/show/HowtoUploadFiles
and that was really helpful.
However, it still isn''t clear to me how I would get access to the image
in my views if
2010 Apr 29
2
send_data => invalid byte sequence in US-ASCII
I''m trying to display a generated .png plot via send_data(), but it
results in a server error "invalid byte sequence in US-ASCII" error.
I''m pretty sure this means that I need to specify the encoding
somewhere, but I haven''t been able to figure out where or how to do so.
Some particulars:
I''m running gnuplot through a pipe to generate a plot in .png
2008 Jun 15
11
Ouch! Can't figure out this file upload issue...
Okay, so this is driving me crazy. I''m trying to do a file upload
using code from a book.
What happens:
I get wrong number of arguments (1 for 0) in the upload controller
save action. No idea why.
Schema:
The schema for the picture model object is just a textfield named
comments and a binary field called data.
Upload controller:
def get
@picture =Picture.new
end
def save
2008 Oct 08
11
Using image_tag and send_data
I am using image_tag to load an image that I''ve saved to the database
(using attachment_fu if you''re curious but that''s probably not
relevant here):
VIEW
<%= image_tag ''/photo/get_image/5'' %>
CONTROLLER
def get_image
@photo=Photo.find(params[:id])
send_data(DbFile.find(@photo.db_file_id).data,
:type =>
2007 Apr 09
6
gruff send_data
Hi,
for those with experience of Gruff module: suppose I want to send
image from server straight to the browser (as example on gruff web
site):
send_data(g.to_blob,
:disposition => ''inline'',
:type => ''image/png'',
:filename => "gruff.png")
the server seems sending this binary data ok, but I am having
2007 Dec 18
2
attachment_fu and S3 -- cannot download file correctly
I don''t know why this isn''t working. If I download a word doc that I
uploaded, all I get is the S3 file path in the document. If I access
the s3 file path directly in my browser, it downloads the file
correctly.
Here is my controller method:
def download
@curriculum = @school.curriculums.find(params[:id])
send_data @curriculum.attachment.public_filename,
:filename
2005 Oct 17
4
How to send excel file to browser (spreadsheat 0.3.2)
hey, i want to generate an excel file and send it directly to the browser
(without storing it to the harddisk).
does anyone has any solution?
thanks in advance
this is my code:
--------------------
def export_excel
if @request.env[''HTTP_USER_AGENT''] =~ /msie/i
@headers[''Pragma''] = ''''
@headers[''Cache-Control''] =
2006 Mar 04
13
file_column
Restricting size of an uploaded file, is how is that possible? If I
do not want a user to upload a file larger than X bytes, can it
easily be done?
If I also would like restrict the types of files that can be
uploaded, how may I do so?
Thank you,
Sharkie
2006 Jul 07
3
quick send_data question...
Hi,
I am using send_data to allow users to download files from the database
but ran into a small problem, it seems that files upload fine but when
they download only 64kb of the file is sent.
I''m using the basic rails code from the Agile book:
#upload code in my sheet model
def file=(document_field)
self.filename = base_part_of(document_field.original_filename)
2006 May 01
2
how to reference a file for download
I have an app that uploads files into the directory RAILS_ROOT/documents/
I tried to access the file for downloading using <a
href="#{RAILS_ROOT}/documents/file_name">my file</a>.
Rails prepends the controller name to the link so I get
<a href="
http://localhost:3000/tasks/show_document/config/.../documents/file_name"
What''s the right way to do this?
2006 Jun 20
2
Problem with "can''t dump anonymous class Class"
I submitted this earlier, but the web forums went down and I''ve screwed up
the thread, so I''m starting over.
I''m trying to built a document upload system. The system has a main
Document model with different subclasses for different types of documents.
With the code below, if I attempt to create a Document, it works fine, but
if I attempt to use one of the subclasses, I
2006 Jun 16
10
Issue with caching of .PNG files in IE..
I''m running a Rails application with WEBrick server. We are displaying
an Image from the server to the Client (Browser). First time on the
browser everything looks fine, upon clicking the link, it contacts the
server and displays in IE brwoser the image that was stored on the
server.
But in case if the image gets changed on the server(File Name being the
same), then even though i
2015 Oct 01
1
doveadm + ldap userdb
Hi!
OS: CentOS Linux release 7.1.1503 (Core)
Dovecot: 2.2.18
Run user listing - doveadm user '*', single user - work.
auth[20540]: segfault at 8 ip 00007fd554340c6b sp 00007ffc17c886e0 error
4 in libauthdb_ldap.so[7fd55433b000+a000]
dovecot: auth: Fatal: master: service(auth): child 20540 killed with
signal 11 (core dumped)
dovecot: auth: Error: net_connect_unix(auth-worker) failed:
2007 Apr 05
5
Odd error handling in ActionView#compile_template causes WSOD
If a view file cannot be compiled (eg it has a block with a missing
''end'' statement), I''m experiencing WSODs - the browser reports a lost
network connection, rather than the helpful compilation error that we
used to have.
When the compilation fails, ActionView#compile_template raises this
error :
TemplateError.new(find_base_path_for(file_name || template), file_name
||
2008 Feb 07
6
Buffer flushing
Short question: is there way to tell EM to actually send data after
send_data call?
I''m building a file transferring app. I send Mashal.dump''ed metadata
first, and then - the file contents (chunked). I found a silly bug:
receive_data() gets marshalled metadata and the first chunk of the
file in a single variable.
Like that:
c1.send_data("meta")
2008 Jan 06
5
Having very odd problems with UDP.
I am using eventmachine 0.8.1 on windows XP and am having very odd problems.
This snippet of code gives the error that follows it.
class EchoServer
def receive_data data
puts data
send_data ">>>you sent: #{data}"
if data =~ /quit/i
puts "quitting"
close_connection
EventMachine::stop_event_loop
end
end
end
2007 Aug 08
12
Some more win32-changenotify analysis
Hi all,
I decided to check the responsiveness of the pure Ruby vs C extension
versions of win32-changenotify. I setup this little file generator program:
a = []
10.times{ |n|
a << Thread.new{
File.open("File_#{n}", ''w''){ |fh| fh.puts "test #{n}" }
}
}
a.each{ |t| t.join }
The pure Ruby version did not do so well. In some cases it
2006 Jan 19
4
UserEngine - rake bootstrap aborted => undefined method `synchronize_with_controllers'' for Permission:Class
Good day all.
I have successfully installed Engines and LoginEngine and LE is setup and
running correctly.
However, after installing and setting up UE, when attempting to run the rake
bootstrap method I get the following error:
undefined method `synchronize_with_controllers'' for Permission:Class
My environment is
Rails 1.0.0
Ruby 1.8.2
WinXP
WebBRICK
MySQL 4.1.14
I found the following