I have a web form(asp.net) which I'm using to upload file. In current situation if a user choose a text file from their computer they have to click a buttton to upload the text in a box. I'm trying to find a way to skip the step with a button pressing.
How to call a C# function when the file is selected from user ?
Function Calling: A function call is an important part of the C programming language. It is called inside a program whenever it is required to call a function. It is only called by its name in the main() function of a program. We can pass the parameters to a function calling in the main() function.
C is a general purpose computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system. It was named 'C' because many of its features were derived from an earlier language called 'B'.
The call by value method of passing arguments to a function copies the actual value of an argument into the formal parameter of the function. In this case, changes made to the parameter inside the function have no effect on the argument. By default, C programming uses call by value to pass arguments.
Just declare the C++ function extern "C" (in your C++ code) and call it (from your C or C++ code). For example: // C++ code: extern "C" void f(int);
Try this
<asp:FileUpload ID="FileUpload01" ClientIDMode="Static" onchange="this.form.submit()" runat="server"/>
in code behind Page_load event
if (IsPostBack && FileUpload01.PostedFile != null)
{
if (FileUpload01.PostedFile.FileName.Length > 0)
{
FileUpload01.SaveAs(Server.MapPath("~/Images/") + FileUpload01.PostedFile.FileName);
imguser.ImageUrl = "~/Images/" + FileUpload01.PostedFile.FileName;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With