Rails and SWFUpload: Sporadic Failure on Upload and Response Issue
Posted
by Gimli
on Stack Overflow
See other posts from Stack Overflow
or by Gimli
Published on 2010-05-13T21:09:30Z
Indexed on
2010/05/13
21:14 UTC
Read the original article
Hit count: 250
I've got SWFUpload version 2.5 beta 3 attached to my Rails 2.3.2 application and it works great 75% of the time. The other 25%, I get types of failure.
The first failure is a failure to upload. The activity starts, but never actually sends the file to the servers. In my JS, when setting breakpoints, it stops between setting the post params and starting the upload (last two lines below):
var params = {
"authenticity_token": authToken,
"photo[name]": $("#photo_name").val(),
"photo[description]": $("#photo_description").val(),
"photo[post_id]": $("#post_id").val()
};
params[keyName] = key;
swfu.setPostParams(params);
swfu.startUpload();
It just occurred to me that the file might not being queued, but I've got a handler attached to show the file name in a text box and that works consistently.
The second issue is this: Sometimes the response string is truncated. I'm rendering a partial in Rails without a layout to show the uploaded file data in my layout. Most of the time this partial comes through fine, but sometimes it comes through as only the first line, or only parts of the first several lines. The variables seem to be coming through into the view just fine. Any ideas?
Thanks!
© Stack Overflow or respective owner