Hi i have a Jqgrid subgrid. inside that i have upload control.
upload control working fine upto asking for the file and select the file.
But i am unable to read the file value in the back end vb.net side.
Javascript code :
$('#FormPath')[0].files[0]
will return [object,file].
That means it is able to read the file.
var fd = new FormData();
fd.append('file', $('#FormPath')[0].files[0]);
$.ajax({
url: 'Forms.aspx/UploadFormDetails',
data: fd,
cache:false,
processData: false,
contentType: false,
type: 'POST',
success: function(fd){
alert(fd);
}
});
My bad luck it is not hitting the code mentioned below. if it hits i may read the file. Vb.net Code
<WebMethod> _
Public Shared Function UploadFormDetails() As String
Dim httpPostedFile = HttpContext.Current.Request.Files("UploadedFile")
If httpPostedFile IsNot Nothing Then
' Get the complete file path
Dim fileSavePath = Path.Combine(HttpContext.Current.Server.MapPath("/Attachments/pdf/Forms/"), httpPostedFile.FileName)
' Save the uploaded file to "UploadedFiles" folder
httpPostedFile.SaveAs(fileSavePath)
End If
Return ""
End Function
Any body have any idea