Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

JSON for image upload

$
0
0

Can you tell me what wrong with my code..

[WebMethod]
[ScriptMethod]
public static void InsertWebService(check c)
{

HttpPostedFile postedFile= c.photo;             
string fileName = System.IO.Path.GetFileName(postedFile.FileName);

//Set the Image File Path.
string filePath = "~/check/" + fileName;

//Save the Image File in Folder.
postedFile.SaveAs(HttpContext.Current.Server.MapPath(filePath));

//performing normal insert query ..
Connection con = new Connection();
SqlConnection conn = new SqlConnection();
SqlCommand cmd = new SqlCommand();
conn = con.getConnection();
try
{

conn.Open();
query = ""; 

// Query written 

}//close finally

AJAX call..

student.photo = $('#photo').val(),   // I need to know if i can send the path like this.. this gives c:\fakepath\fileuploaded.jpg

//normal call to web service

can you tell what is going wrong


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>