且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将Rails与Paperclip和SWFUpload一起使用

更新时间:2023-09-19 14:40:52

要将照片文件字段ID传递给SWFUpload,您的字段ID将为user_photo(来自< input type ='file'id =' user_photo'.../>),因此使用

For passing the photo file field id to SWFUpload, the id of your field is going to be user_photo (from <input type='file' id='user_photo'.../>), so initialize swfupload with

var swfupload = new SWFUpload({button_placeholder_id:'user_photo' ... });

它将用swf上传器替换文件字段.

which will replace the file field with a swf uploader.

请记住,默认情况下,文件将作为"Filedata"参数上传.从技术上讲,您可以将其更改为'user [photo]',但显然在Linux上不起作用,因此您可能必须在服务器端进行一些调整,才能将其移到正确的位置.

Bear in mind that by default the file will get uploaded as the 'Filedata' parameter. Technically you could change that to 'user[photo]', but apparently that doesn't work on Linux, so you may have to do some shimmying on the server-side to move that into the right place.