hii,
i am trying to upload some files to filesystem using rails application
when i use small size file everything is perfect but i when goes for
larger files i got error
this is my code
#this model file
class DataFile < ActiveRecord::Base
def self.save(upload)
name = upload['datafile'].original_filename
directory = "//192.168.147.17/Smruti/streams"
# create the file path
path = File.join(directory, name)
# write the file
File.open(path, "wb") { |f| f.write(upload['datafile'].read) }
end
end
#this is my controller
class UploadController < ApplicationController
def index
render :file => 'app\views\upload\uploadfile.rhtml'
end
def uploadFile
post = DataFile.save(params[:upload])
render :text => "File has been uploaded successfully"
end
end
hii,
i am trying to upload some files to filesystem using rails application
when i use small size file everything is perfect but i when goes for
larger files i got error
this is my code
#this model file
class DataFile < ActiveRecord::Base
def self.save(upload)
name = upload['datafile'].original_filename
directory = "//192.168.147.17/Smruti/streams"
# create the file path
path = File.join(directory, name)
# write the file
File.open(path, "wb") { |f| f.write(upload['datafile'].read) }
end
end
#this is my controller
class UploadController < ApplicationController
def index
render :file => 'app\views\upload\uploadfile.rhtml'
end
def uploadFile
post = DataFile.save(params[:upload])
render :text => "File has been uploaded successfully"
end
end
hii,
i am trying to upload some files to filesystem using rails application
when i use small size file everything is perfect but i when goes for
larger files i got error
this is my code
Check the Webserver's (e.g. Apache) file size limit. It may be set to some
small value.
hii,
i am trying to upload some files to filesystem using rails application
when i use small size file everything is perfect but i when goes for
larger files i got error
this is my code
Check the Webserver's (e.g. Apache) file size limit. It may be set to
some
small value.
HTH,
Jeffrey
Thanks for responding Jeffrey
but i am new to rails ,so where do i find Webserver file size limit ,am
running
mongrel as server and one more thing i would like to mention is when am
trying to upload large file (320 mb),file is being uploaded to phyical
location but i am getting error like
Jeffrey L. Taylor wrote:
> Quoting Amit Tomar <lists@ruby-forum.com>:
>> hii,
>> i am trying to upload some files to filesystem using rails application
>> when i use small size file everything is perfect but i when goes for
>> larger files i got error
>> this is my code
>>
>
> Check the Webserver's (e.g. Apache) file size limit. It may be set to
> some
> small value.
>
> HTH,
> Jeffrey
Thanks for responding Jeffrey
but i am new to rails ,so where do i find Webserver file size limit ,am
running
mongrel as server and one more thing i would like to mention is when am
trying to upload large file (320 mb),file is being uploaded to phyical
location but i am getting error like
When i looked into the streams folder file is there...
I don't know Mongrel, but I'd look in the Mongrel configuration file. I
expect Mongrel is cutting off or aborting the file transfer and then throwing
the InvalidArgument exception.
In Nginx, the setting is:
client_max_body_size 0; # don't limit the upload file size
When i looked into the streams folder file is there...
I don't know Mongrel, but I'd look in the Mongrel configuration file. I
expect Mongrel is cutting off or aborting the file transfer and then
throwing
the InvalidArgument exception.
In Nginx, the setting is:
client_max_body_size 0; # don't limit the upload file size
In Apache, the setting is:
LimitRequestBody 500000
Look for something similar.
HTH,
Jeffrey
Jeffrey i edit the code and things starts working for me
#this model file
class DataFile < ActiveRecord::Base
def self.save(upload)
name = upload['datafile'].original_filename
directory = "c:/dm"
# create the file path
path = File.join(directory, name)
# write the file
File.open(path, "wb") { |f| f.write(upload['datafile'].read) }
end
end
i added two lines
target="//192.168.147.17/Smruti/streams"
File.copy(path,target)
ans i changed
directory = "c:/dm"
and things are working for me
but could you tell me what was happening before why am getting
Invalid argument -