Hi guys
is there anyone who knows how to upload files? can u give me the required codings?
Thx Regards Kushan
Hi guys
is there anyone who knows how to upload files? can u give me the required codings?
Thx Regards Kushan
is there anyone who knows how to upload files? can u give me the required codings?
i already followed wht that page says, but it wont work can anyone give me codings im sure some one may have done file uploading
Regards Kushan
i already followed wht that page says, but it wont work can anyone give me codings im sure some one may have done file uploading
Someone has, and they posted the code on the wiki. If it's not working then it would be more helpful to know what error you are getting.
this is the error i got
undefined method ‘read’ for “c:\modernchef.txt”:String
this is the model that i wrote
def self.save(metro_upload) File.open(“Metro_SQL/#{metro_upload[‘name’]}/metro.sql”, “w”) {
>f>
$readedFile = f.read(metro_upload['sql_file'].read)
f.write($readedFile)
}
end
end
Check out the acts_as_attachment plugin it works great. Here is a tutorial for it from the author of the plugin http://weblog.techno-weenie.net/articles/acts_as_attachment
Your bug is probably in this line:
$readedFile = f.read(metro_upload['sql_file'].read)
Since that's the only one with calls to a method named 'read' (note the error message). And since f.read is definitely a valid method call, the second one would seem the likely culprit. Why are you calling metro_upload['sql_file'].read? Isn't the value of metro_upload['sql_file'] "c:\\modernchef.txt"?
Hi,
You can use 'file_column' to control file/image uploadings
Cheers, Robert