Click here to Skip to main content
15,886,689 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello folks,

I am needed your guide that how to upload a file from Asp.net MVC Using WCF Rest service calling from Jquery-Json/Jquery-Ajax without page refresh .I don't want to use Ajax Update panel or something other .i want to upload file without page refresh WCF Rest.If its is possible to store file in database which is converted into byte OR it is possible to upload a file which is store on server folder .if yeah then how to .if anyone have idea please share .its really appreciated me.Thanks in advance .

Warm Regard

KP Singh Chundawat
Posted
Updated 14-Dec-14 8:44am
v2
Comments
Kornfeld Eliyahu Peter 14-Dec-14 14:51pm    
http://mattgemmell.com/what-have-you-tried/

To upload the files without a POST request (page refresh) you would need a client-side framework. JavaScript is one of them. You should be using jQuery, to make things easier.

You can create a new ajax request (Ajax request is required, there is no other way for you to send the data to the server without creating a new ajax request). You can pass the form data to that request, and it will send the data on to your servers.

It is a little technical thing to understand and conceptualize in the beginning but as time passes you will understand. Read my article on sending the files to the server using jQuery: Uploading the files – HTML5 and jQuery way![^].

As far as storing the files on the server is concerned, I would go with saving the files on the file system, rather than storing the files in the database. The database space is really expensive and costly, and you also have to manage the space efficiently. So wasting those bytes of space would be foolish. I would recommend that you store those files on the file system, which in most of the cases are Unlimited.

However, I am not understanding why do you need the WCF to involve? If somehow, still you need to consume WCF, you should learn about the client's and their methods to send the data, and all that stuff. http://msdn.microsoft.com/en-us/library/dd456779%28v=vs.110%29.aspx[^]
 
Share this answer
 
v2
Thanks for this Ahmad Zeeshan sir...yeah that is good if it is possible using Jqury..Please give me Code idea ..Actually my requirement is that fileupload in Client side or Without Page Refresh ....Thanks
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900