By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,789 Members | 1,436 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,789 IT Pros & Developers. It's quick & easy.

file upload using AJAX

P: 1

Iím trying to create an application with AJAX which would upload a file on to the server. Am sending the request through the browser to the Servlet which uses the API. I have constructed the request body as follows....

var boundaryString = 'AaB03x';
var boundary = '--' + boundaryString;
var requestbody = boundary + '\n'
+ 'Content-Disposition: form-data; name="attachmentName"' + '\n'
+ '\n'
+ atchmntName.value + '\n'
+ '\n'
+ boundary + '\n'
+ 'Content-Disposition: form-data; name="locationPath"; path="'
+ atchmntPath.value + '"' + '\n'
+ 'Content-Type: application/octet-stream' + '\n'
+ '\n'
+ boundary;

When i run this...i get an exception saying..."Stream ended unexpectedly" i missing something here......plz HELP !!!
Feb 22 '07 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 15k+
P: 16,027
To perform a file upload using Ajax, you will probably need an iframe. See an example here.
Feb 22 '07 #2

P: 2
Anyone have an example for uploading multiple files and showing a thumbnail of them without refreshing the page?
Feb 22 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.