Ajax file upload #117

raviraj555 opened this Issue Jul 10, 2012 · 3 comments

2 participants


Hi All,

I am able to upload file by form post
I used Req:post_files()

but I want to implement same functionality by Ajax,I done following code but don't know how to get the data at erlang side
as post data will be in multipart i.e.
Content-Disposition: form-data; name="file-0"; filename="MergedTable.rtf" Content-Type: application/rtf {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\fswiss\fcharset0 Arial;}} {*\generator Msftedit;}\viewkind4\uc1\pard\b\f0\fs24 Table : \b0 notification \b (From Address data will add in this table)

My Code

               var data = new FormData();
                jQuery.each($('#fileinput')[0].files, function(i, file) {
                    data.append('file-'+i, file);

                    url: '/file/fileupload',
                    data: data,
                    processData: false,
                    type: 'POST',
                    mimeType: 'multipart/form-data',
                    success: function ( data ) {
                        alert( data );

please help me


I tried but still post params are same and don't know how to catch it in controller action, any more suggestion?


This is not a CB issue, closing

@evanmiller evanmiller closed this Jan 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment