Displaying 17 results from an estimated 17 matches for "file_data".
2007 Aug 22
8
How to spec an attachment_fu model
...<p><%= f.file_field :uploaded_data %></p>
# <p><%= submit_tag :Save %>
# <% end -%>
#
# @attachment = Attachment.create! params[:attachment]
#
# TODO: Allow it to work with Merb tempfiles too.
def uploaded_data=(file_data)
return nil if file_data.nil? || file_data.size == 0
self.content_type = file_data.content_type
self.filename = file_data.original_filename if
respond_to?(:filename)
if file_data.is_a?(StringIO)
file_data.rewind
self.temp_data = file_data.rea...
2006 May 10
0
Saving extracted data
Hi there,
I have a file upload form on my page that is for images. In the model I have
this:
def file_data=(file_data)
@file_data = file_data
write_attribute ''extension'',
file_data.original_filename.split(''.'').last.downcase
write_attribute("content_type", file_data.content_type)
write_attribute("current_name", file_data.original_fil...
2006 Apr 24
0
ImageMagick and EXIF Data
...eRecord::Base
DIRECTORY = ''public/uploaded_images''
THUMBDIRECTORY = ''public/thumbs''
DISPLAY_DIRECTORY = ''/public/uploaded_images/''
DISPLAYTHUMBS_DIRECTORY = ''/public/thumbs/''
after_save :process
after_destroy :cleanup
def file_data=(file_data)
@file_data = file_data
write_attribute ''extension'',
file_data.original_filename.split(''.'').last.downcase
write_attribute("content_type", file_data.content_type)
write_attribute("original_name", file_data.original_fi...
2012 Nov 04
1
hexdump.c32 for Syslinux 5.00-pre9
...o_page(void);
+static void hexdump(const void *memory, size_t bytes);
+
+/* Objects */
+static const char *prog_name;
+static int opt_page;
+static int opt_no_buffer;
+static int opt_extended_ascii;
+
+int main(int argc, char **argv)
+{
+ int rc;
+ const char *filename;
+ int i;
+ void *file_data;
+ size_t file_sz;
+ FILE *f;
+ size_t len;
+ const char *cur_pos;
+
+ /* Assume failure */
+ rc = EXIT_FAILURE;
+
+ /* Determine the program name, as invoked */
+ if (argc < 1 || !argv || !argv[0]) {
+ fprintf(stderr, "argc or argv failure!\n");
+ goto err_prog...
2006 Jul 03
7
form_remote_tag with multipart/form-data
...supports multipart/form-data ?
My form looks like this:
<%= form_remote_tag :url => { :action => ''do_image_upload'' },
:html => { :enctype => ''multipart/form-data'' } %>
<%= file_field ''image'', ''file_data'', :size => 32 %>
<%= submit_tag ''Upload'' %>
<%= end_form_tag %>
and produces:
<form action="/home/do_image_upload" enctype="multipart/form-data"
method="post" onsubmit="new
Ajax.Request(''/home/do_image_upl...
2007 Aug 03
6
Problems saving an uploaded image to an app folder
...ing "no ''write'' method exists for String":
can anyone see what i''m doing wrong here? (i''ve just enclosed the
model methods as all the controller does is call ''write_to_disc'' on my
picture instance):
#in class Picture
attr_accessor :file_data
def picture_file=(input_data)
self.filename = input_data.original_filename
self.content_type = input_data.content_type.chomp
self.file_data = input_data.read
end
def write_to_disc
#save the picture to newspipe/data/pictures with the name
''#{self.id}.extension''...
2008 Aug 11
1
Unexpected parameter problem using rsaga.geoprocessor() {RSAGA}
...ge of and arguments required by the SAGA command
line "Import Binary Raw Data" module, I used:
> rsaga.get.usage("io_grid", 4)
SAGA CMD 2.0.3
library path: C:/Progra~1/saga_vc/modules
library name: io_grid
module name : Import Binary Raw Data
Usage: 4 [-GRID <str>] [-FILE_DATA <str>] [-NX <num>] [-NY <num>] [-DXY
<str>] [-XMIN <str>] [-YMIN <str>] [-UNIT <str>] [-ZFACTOR <str>]
[-NODATA <str>] [-DATA_OFFSET <num>] [-LINE_OFFSET <num>] [-LINE_ENDSET
<num>] [-DATA_TYPE <num>] [-BYTEORDER_BIG &...
2016 Nov 04
4
[PATCH 0/2] improve Lua API for files and initramfs objects
From: Paul Emmerich <p.emmerich at first-colo.net>
Hi,
the new API for initramfs and files in master lacked the ability to build
initramfs objects from files loaded via HTTP/TFTP in Lua. The documentation
indicated that it should be possible (and I believe I did that in an older
version). I implemented a few new functions to handle files/initramfs
objects better.
Changes:
* NEW:
2008 Nov 13
3
Creating a file and saving in public directory
...#39;m trying to create a text file that
is saved in a /public/report directory.
I''ve had a look at the ruby api but I can''t seem to get this working.
The current code I have is:
#report.rb
class Report < ActiveRecord::Base
after_save :write_file
def write_file
if @file_data
File.makedirs("#{RAILS_ROOT}/report")
File.open("#{RAILS_ROOT}/report/waiting.adc", "w") { |file|
file.write("hello world") }
end
end
end
#report_controller.rb
def new
@report = File.new
end
def create
if @report.save
fl...
2011 Mar 29
0
[PATCH] Implementation for sl_initramfs_add_file() in lua.c32
...0
@@ -385,12 +385,10 @@ static int sl_initramfs_load_archive(lua
static int sl_initramfs_add_file(lua_State * L)
{
struct initramfs *initramfs = luaL_checkudata(L, 1, SYSLINUX_FILE);
- /* FIXME: This code is doing nothing */
- //const char *filename = luaL_checkstring(L, 2);
- void *file_data = NULL;
- size_t file_len = 0;
-
- return initramfs_add_file(initramfs, file_data, file_len,
file_len, "/testfile1", 0, 0755);
+ struct syslinux_file *file = luaL_checkudata(L, 2, SYSLINUX_FILE);
+ const char *dst_filename = luaL_checkstring(L, 3);
+ size_t file_len = file-...
2008 Apr 25
1
attachment_fu and mime type issues
...h the attachment_fu plugin and flac audio files. In
the dev environment, using mongrel, the form upload object does not seem to
have any associated content_type. I get the following attachment_fu
validation error: "Content type can''t be blank". I don''t understand why the
file_data would not have any content_type. Doesn''t rails set the content
type based on the mime type? How is it that a file can be uploaded without
any mime type at all? Shouldn''t it at least have application/octet-stream if
the server can''t parse the actual file type? I tried star...
2008 Jul 04
9
file upload
is there any link for step by step guide in file upload in database ...
im follwing the link
http://www.tutorialspoint.com/ruby-on-rails/rails-file-uploading.htm..
which shows file upload into folder not in database ..pls help..
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
2007 Apr 26
8
Win32 service - Errno::EINVAL (Invalid argument) when uploading image file
Hi guys,
I''m facing an error trying to run my app as mongrel_service, hope those who
have faced similar issue can help to shed some lights.
The app was fine when running from console, but when running it as a
service, it failed when I try to upload ''image file'', it has no issue
uploading other types of files.
Environment:
------------
mongrel (1.0.1, 0.3.13.3)
2006 Oct 21
0
[702] trunk/wxruby2: Additions to allow faster compiling via a Makefile on dual-processor
...extra_obj.each do |o|
+ obj_no_dir = o.sub(''obj/'','''')
+ rule = "#{o}: src/#{obj_no_dir.sub(''.o'',''.cpp'')}\n\t#{$cpp} -c #{$verbose_flag} #{$cppflags} #{out_arg}$@ $^\n\n"
+ object_rules << rule
+ end
+
+file_data =
+%{#This is generated by rake do not edit by hand!
+
+OBJ = #{all_obj_files_and_extra_obj.join('' '')}
+
+rakemake: $(OBJ)
+
+#{object_rules}
+}
+
+ file = File.new("makefile","w+")
+ file.write(file_data)
+end
+
+def run_makefile(num_threads=1)
+ syste...
2006 May 02
2
Mechanize and file_column
...ored eye like the query keys are getting
double-quoted on upload. Anyone else seen this, or anything like it?
The code driving mechanize looks like this:
img = @form.file_uploads.find{|f| f.name == ''snapshot[screenshot]''}
img_name = time + ''.png''
img.file_data = File.read(File.join(dirname, img_name))
img.file_name = img_name
img.mime_type = ''image/png''
@form.fields.find{|f| f.name == ''snapshot[processes]''}.value = ''''
response = @agent.submit(@form)
puts response.body
@form is found fr...
2006 Apr 24
1
Upload Progress Bar not showing
...al_filename}", "w") { |f|
f.write(upload_file.read) }
self.filename = upload_file.original_filename
self.content_type = upload_file.content_type
self.size = upload_file.size.to_s
end
def before_destroy
File.delete("files/#{self.filename}")
end
def file_data
IO.read("files/#{self.filename}")
end
end
For the reference, I''m on DreamHost, using Apache 1.3, Ruby 1.8.2, and
Ruby on Rails 1.1 (I have it installed in vendors/rails-1.1). Any help
on this would be much appreciated. Thanks.
-Jon
--
Posted via http://www.ruby-forum....
2012 Jul 07
18
Problem processing text file after uploading
I''ve got a web-app currently partially working. The user uploads a .txt,
.docx or .doc file to the server.
Currently the model handles those files, saves some metadata (the
extention and orig filename) then saves the file to the hard drive. Next
it converts the doc and docx files to plain text and saves the output to
a txt file.
My problem is I want to copy the plain text contents of