Click here to Skip to main content
15,887,821 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a html form and i am filling this form automatically using c# web browser..I have done filling all the fields,except choose file option..
Choose file option is used to select files..in my case it selects image..
what i want is that, i want to give it a value like:

<input type="file" name="something" value="c:\image1.jpg" />..

But due to security reasons value attribute is not allowed for file type..so i can not give it a url of my image..
here is the code of webpage..

<input type="file" name="image" class="js_uploader_files_input" size="30" önchange="addMoreToProgressBar();">

Basically what i want is to upload image..
so i think there can be 2 options..
1)if i can give the image source to input tag.
2)or automatically upload the image.

Kindly suggest me,the way to solve this..
let me remind u i am not using http web request..i am using c# webbrowser.to do this..

you people can also suggest me some code as well to do this...!
Posted

1 solution

Here is the solution for WebBrowser control: Setting a file to upload inside the WebBrowser component[^].

But in general it is a better approach to simulate/emulate a browser, and not automate it. For such tasks using HttpClient[^] is a much better approach - but a different one, since you need more http knowledge, and you need to get to know the client-server data exchange of the web application.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900