Hi,
I want to upload file. but when I use<input type="file" runat="server"> & with one button.
when I click on button then my page cannot be found.
such type of error occured. means when I add that input type file tag that error occured.

have u tried enctype="multipart....?

<form action="/example/UploadImage" method="post" [B]enctype="multipart/form-data"[/B] 
           name="form1" id="productForm" onsubmit="return update();">

Yes I use that same code...

well Mr. can you me the size of your file...which you are trying to upload..

if your file size is above 4 MB then i have the solution...

I have word document to upload & now It shows me error that "Cannot find server or DNS Error"
shall I need to change web.config file..?

This error might be accure by varios reasons.

1. Check whether you are trying to upload a document with size more than 4 MB. Refer this link.
2. Also check the size of the ViewState of your page. If the ViewState has a larger size, it might cause this error to occur. Check this thread.

Also check your network connectivity.

Use FileUpload control. (if are working with .netframeworkd 2.0)

Thanks to all,
I used fileupload control & in webconfig file I simply add <httpRuntime maxRequestLength ="45600"/>
& Finally I can upload files without any error.

Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.