Displaying 20 results from an estimated 1000 matches similar to: "Uploading files - getting size"
2006 Jul 03
0
Multiple File Upload
Hello together,
I developed a file upload in my application like this (files uploaded
belong to a project):
project_controller.rb:
----------------------
def upload_attachment
project = Project.find(@params[:id])
begin
project.attachments.create(params[:attachment])
rescue
flash[:attachment_error] = "Error at Upload"
end
redirect_to :action => "edit_project", :id
2007 Jul 05
2
undefined method `original_filename' for "random.jpg":String
I have a problem getting attachments to work in a specific case...
I have the following data model (this is a relevant subset of it):
- a log can have many journals
- a journal belongs to a log and can have many attachments
- an attachment belongs to a journal
When adding on a new journal to an existing log the new journal form and
the corresponding controller handle the attachment as well and
2006 Feb 05
0
validating presence of file uploads
not sure whats going on here, but I''m using some pretty standard code to
manage file uploads in to a db, but having trouble detecting if the file
upload field has been filled or not.
in my Asset Model, I have:
def asset=(asset_field)
self.name = base_part_of(asset_field.original_filename)
self.content_type = asset_field.content_type.chomp
self.data = asset_field.read
end
def
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 Mar 06
1
Uploaded File to Database
Hi,
I currently write a tool for my school. Therefore I have to save
uploaded files.
I bought Agile Web Dev. with Rails to learn webdev with Rails.
I''m very new at rails and couln''d find anything on the internet.
Now when I want to save the file data to the mysql database, rails gives
me an error.
My code is the same as written in the book on page 363.
Here is my code of the
2006 Feb 06
2
File_field and Firefox
Hi!
Im developing a simple prototype of an application. It fills an oracle
db with data about a file in the filesystem, and save the entire file
in a blob along with some metadata. To get the file in the db i use a
file_field form helper. All goes well with the radrails-integrated
browser, but it doesnt work anymore in firefox. The problem is,
firefox seems to cut the pathname from the file.
Here
2005 Sep 07
0
model constructor errors.
I have a model; I do photo = Photo.new(parameters) parameters
contains: {"picture"=>#<File:C:/DOCUME~1/BART~1/LOCALS~1/Temp/CGI3180.1>}
so i expect that the def picture=(filename) method is called in this
constructor.. this is not the case. Does anyone know why?
params[:photo].each_pair do |id, parameters|
photo = Photo.new(parameters)
end
class Photo
2006 May 29
3
File.size() on Uploaded Images Fail
I am checking the file size of an uploaded file and storing it in a filesize
column. It will work just fine when the user uploads any files other than
images (jpg,png,gif).
Word, Excel, Powerpoint, .zip and more all work fine.
This is my model asset.rb that handles the file upload.
def newfile=(newfile_field)
self.filename = base_part_of(newfile_field.original_filename)
self.filetype
2006 Jun 19
3
can''t dump anonymous class Class
I''m trying to create a document upload system, where most of the code is
the super class Document and just the path to file on the system is
controlled by the sub classes. When I attempt to use my code, I get the
following when I try to save the document.
can''t dump anonymous class Class
Any ideas?
** Migration **
class CreateDocuments < ActiveRecord::Migration
def
2006 Jul 18
0
ffmpeg and IO.popen
i?m fairly new to ruby...
any suggestions getting the below to work...
i?d like to use myfile_field.read within encodeVideo
and then self.data = Student_Interviews.flv
class Myfile < ActiveRecord::Base
.
.
.
def encodeVideo opts #, stream
IO.popen(?ffmpeg #{opts}?, ?w?)#{ |io| io.puts stream}
end
def myfile=(myfile_field)
if myfile_field and myfile_field.length > 0
encodeVideo ?-i
2006 Aug 01
3
Upload file to file system and sql insert date errors
I''m trying to use one form to upload a file to the file system
and insert a title and description field into the database.
I have no problem uploading files to the file system
using the code from
http://wiki.rubyonrails.com/rails/pages/HowtoUploadFiles
There are more fields on the form than need to be inserted into
the database, name and file.
I need to pull out these extra fields
2006 Jan 09
1
Saving an upload
I am creating a database for movies (films) and television shows (shows)
that will have has_and_belongs_to_many relationships with the pictures
table.
CREATE TABLE screenshots (
id serial NOT NULL,
filename character varying NOT NULL,
content_type character varying NOT NULL,
primary key (id)
);
CREATE TABLE films (
id serial NOT NULL,
name character varying NOT NULL,
2006 Jun 28
2
Ajax - Upload File Upload
hello, i have a problem. I want to upload a file with ajax and the
following tag:
submit_to_remote ''button_save'',''Speichern'',{
:url => {:action => ''ajax_update'', :id => @product},
:update => ''formular''
}
it doesn''t work, my form_tag looks like:
form_remote_tag(:url => {:action =>
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
2011 Jul 29
1
Using perm.t.test() upon Matrix/Dataframe columns parted by factor instead of t.test()
Hello dear subscribed Users,
this is my first post, so please forgive me for any inconveniences.
The following problem: I have a dataframe containing a factor column.
For each column i would like to compare means as parted by the factor.
Using the normal t.test function I have already achieved my goal. But i
think, that for my original data, a permutational t.test would be better
suited.
2011 Apr 30
1
More flexible aggregate / eval
Dear list,
I would like to do some calculation using different grouping variables.
My 'df' looks like this:
# Some data
set.seed(345)
id <- seq(200,400, by=10)
ids <- sample(substr(id,1,1))
group1 <- rep(1:3, each=7)
group2 <- rep(1:2, c(10,11))
group3 <- rep(1:4, c(5,5,5,6))
df <- data.frame(id, ids, group1, group2, group3)
df <- rbind(df, df, df)
df$time <-
2005 Oct 19
1
samba-3.0.10-1.4E (RHEL4); Invalid key XXX given to dptr_close
Hi List,
need your help, property the here following.
OS / Samba = samba-3.0.10-1.4E (RHEL4)
Error message in Samba logfile = Invalid key XXX given to dptr_close
This message comes then if by NT server with BrighStore a Backup is started.
The Backup is made by a Share.
all the same with or without
kernel oplocks = no
level2 oplocks = no
oplocks = no
without success
Info:
Error Log from
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
2010 Feb 14
1
mlogit function cut off formular
I'm trying to fit a multinominal logistic model using package mlogit. I have
15 independent variables. The code looks like this:
m<-mlogit(score~0|f1+f2+f3+f4+f5+f6+f7+f8+f9+f10+f11+f12+f13+f14+f15, data,
reflevel="1")
And it gives the following error message:
Error in parse(text = x) :
unexpected ')' in "score ~ 0 + alt:(f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8
+ f9
2012 Apr 26
0
nnet formular for reproduce the expect output
Dear All,
I am recently working on neural network using nnet package. The network has
4 hidden layers and 1 output layer, the target output 1 or 0.
The model I use is as follows:
nn<-nnet(target~f1+f2+f3+f4+f5+f6+f7+f8+f9+f10,data=train,size=4,linout=FALSE,decay=0.025,maxit=800)
It works well and give me ROC 0.85. However, when I want to reproduce the
result in java, I cannot get the same