Forum: Ruby on Rails form with more than 1 file upload field saves 0 byte file fo

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D323e0daf5c222c68f89e0566002d0cc?d=identicon&s=25 Douglas Tan (Guest)
on 2006-01-09 04:44
(Received via mailing list)
Im using the file_column plugin to upload files from my application. The
problem I am encountering is that I have a form with 2 file upload
fields
and when I submnit that form with files selected, I would get a message
from
the browser(Firefox) saying that a script on the page is taking a long
time
to execute and whether I want to cancel it or continue. Whichever option
I
choose, only 1 file(PDF) is uploaded fully to the server while the
other(Image) has a filesystem entry but its 0 bytes.
4bd34a2216dc8bdbf1f017f64e4d59e8?d=identicon&s=25 Kyle Maxwell (Guest)
on 2006-01-09 19:29
(Received via mailing list)
On 1/8/06, Douglas Tan <bianster@gmail.com> wrote:
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
>

Can you run the unit tests that come with file_column?  I know that
there is test coverage for that problem. Let us know if it passes on
your server.

--
Kyle Maxwell
Chief Technologist
E Factor Media // FN Interactive
kyle@efactormedia.com
1-866-263-3261
D323e0daf5c222c68f89e0566002d0cc?d=identicon&s=25 Douglas Tan (Guest)
on 2006-01-10 14:13
(Received via mailing list)
I ran the tests and here's the output:

Using native MySQL
./abstract_unit.rb:20: warning: already initialized constant
DEFAULT_OPTIONS
Loaded suite file_column_test
Started
.............F....F.............................E.F.....
Finished in 1.693641 seconds.

  1) Failure:
test_default_options(FileColumnTest) [file_column_test.rb:46]:
<"./public/uploads/entry/image"> expected to be =~
</\/public\/entry\/image/>.

  2) Failure:
test_dir_methods(FileColumnTest) [file_column_test.rb:178]:
<"/home/douglas/public_html/flare/vendor/plugins/file_column/test/public/entry/image/10">
expected but was
<"/home/douglas/public_html/flare/vendor/plugins/file_column/test/public/uploads/entry/image/10">.

  3) Error:
test_store_dir_callback(FileColumnTest):
TypeError: can't convert Fixnum into String
    file_column_test.rb:191:in `join'
    file_column_test.rb:191:in `test_store_dir_callback'

  4) Failure:
test_tmp_dir_with_store_dir_callback(FileColumnTest)
[file_column_test.rb:199]:
<"/home/douglas/public_html/flare/vendor/plugins/file_column/test/public/my_store_dir/tmp">
expected but was
<"/home/douglas/public_html/flare/vendor/plugins/file_column/test/public/uploads/my_store_dir/tmp">.

56 tests, 173 assertions, 3 failures, 1 errors

The test with 2 file columns seems to pass so i'm baffled by this.
4bd34a2216dc8bdbf1f017f64e4d59e8?d=identicon&s=25 Kyle Maxwell (Guest)
on 2006-01-10 22:32
(Received via mailing list)
On 1/10/06, Douglas Tan <bianster@gmail.com> wrote:
>    1) Failure:
> 
<"/home/douglas/public_html/flare/vendor/plugins/file_column/test/public/uploads/entry/image/10">.
> 
<"/home/douglas/public_html/flare/vendor/plugins/file_column/test/public/my_store_dir/tmp">
> > On 1/8/06, Douglas Tan <bianster@gmail.com> wrote:
> > > other(Image) has a filesystem entry but its 0 bytes.
> > there is test coverage for that problem. Let us know if it passes on
> > Rails mailing list
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
>

Have you tried different browsers and web servers?

--
Kyle Maxwell
Chief Technologist
E Factor Media // FN Interactive
kyle@efactormedia.com
1-866-263-3261
D323e0daf5c222c68f89e0566002d0cc?d=identicon&s=25 Douglas Tan (Guest)
on 2006-01-11 03:51
(Received via mailing list)
I have the same problem when performing uploads on my development
machine,
the results from the file_column_test.rb are similar to the ones on the
live
server. I've tried Firefox, IE and Opera, the results are the same
though
D323e0daf5c222c68f89e0566002d0cc?d=identicon&s=25 Douglas Tan (Guest)
on 2006-01-11 10:37
(Received via mailing list)
okay, i found out what the problem was, as the files were being saved
with
0600, I added an after_save handler to the model classes and set the
file
permissions to 0644. I think I was overriding file_column's after save
handler and causing the issue.
This topic is locked and can not be replied to.