how to save file using type:file in form


I am trying to use type:file inside form. Because I only need to upload one file at a time. I don’t want to use uploader since the control is too big and can upload multiple files at a time. Also, I need to display image preview after user select file. My code is as below.

Inside form onChange event I call function to preview image. It is working fine.

But I don’t know how to save that image. I tried to use

Then submit this form on button click event.

But there is no file inside HttpContext.Request.Files[“file”]. It returns null value. I also tried below method. But still no luck.

Anything I did wrong?


for type:file you have to add real-form wrap around dhtmlx form and submit real form. here is a similar demo: … _form.html