asp.net ajax upload file real time progress bar not working -
i trying ajax file upload , real time progress bar, have tested in localhost , worked perfectly, when tried testing on online web server bar didn't work till end of uploading file, when put system.threading.sleep(value) in end of uploading loop, bar worked uploading slow,
how can resolve this?
the steps used:
construct iframe(point upload.aspx) , file upload inside it.
on pageload javascript function iframe page called window.parent.register(form) function predicate iframe form javascript variable in parent page.
in parent page (default.aspx) placed button, , onclick iframe form predicated submited. javascript interval calls ajax callback function every (1000ms).
this function (the ajax callback) watching session["uploadinfo"].
when iframe form submits iframe page, calls doupload() method reads file in while loop (fileupload.postedfile.inputstream.read(bytes,0,1);) writes byte in specific path, , adds (1) session["uploadinfo"] (which increases progress bar).
i want doupload , ajax callback functions work synchronously.
when run website in
localhost
every thing works expect, when run website progress bar not work.
notice: when put system.threading.thread.sleep(100) in while loop progress bar works, slow.
hi found answer while search non-flash file upload solution progress bar , file size validation.
in general, need flash or java applet works both client-side browser , server-side.
but, looking exact solution of have tried.
you tried problem implementation logic. understood javascript cannot access local file system. depend on ajax server-side code tell amount of file received/uploaded.
the asynchronous call file calculates filesize idea. understand problem face, need understand way works.
the file upload made streamreader , streamwriter residing @ browser-end filesystem @ server-side. may need consider same origin policy important multiple ajax request server.
by http 1.1 specification, browser throw 2 parallel connections server @ same time. in other words, 2 resources can downloaded same domain name.
please check these options , post reply. better go component. using obout file uploader (http://www.obout.com/obout.ajax.ui/fileupload/). work many years. need flash less component per customer requirement. otherwise best asp.net component used file upload.
Comments
Post a Comment