Is there a way how to convert the string to HttpFilePostedBase?
I'm currently using the Ajax File upload . But the value that it return is string. But my method is requesting for HttpFilePostedBase
is there a way how to cast or convert it to HttpFilePostedBase
?
here's my sample method in uploading files.
public bool uploadfiles(HttpPostedFileBase filedata)
{
bool status = false;
//code for uploading goes here
return status;
}
How can i call this method if the ajax file upload is passing a string?
You can't. You can access files posted to an aspx page via the
HttpContext.Request.Files
property.Are you using IE or Chrome/Firefox? cause, different browsers upload files in a different manner. IE uploads the files through Requres.Files but others use
qqfile
in the query string. Take a look here on how to use valums with mvc for different browsersEDIT: Okay then, how about this. This is an example which worked for me: