FileInput upload webmethod

Web Tips Q & ACategory: Krajee PluginsFileInput upload webmethod
pethum asked 2 years ago

i am using your fileinput in my website. but i need to ajax post file and other data. how can i pass fileinput into C# server webmethod.

2 Answers
Kartik Staff answered 2 years ago

You can read the POSTED FILE blob data to the server. For example in PHP it is $_FILES.
I do not have an example for ASP.NET. But an article for AJAX Uploads using FileInput plugin is mentioned for PHP example here.

markinfurkin answered 2 years ago

I successs make  work on project, but not in webmethod, i create another aspx file(with code file cs), and i make this code:

 if (Request.Files.Count > 0)
string path = "c:\\temp\\";
for (int i = 0; i < Request.Files.Count; i++)
var file = Request.Files[i];
path += file.FileName;
catch (HttpException ex)
var serializer = new JavaScriptSerializer();
string jsonError = serializer.Serialize(new { error = "Error on sending files" });

Login or register to contribute or comment.

Login   Register