external fileupload window, programmically input path and file, then h

  • (2 Pages)
  • +
  • 1
  • 2

23 Replies - 2118 Views - Last Post: 23 July 2012 - 06:56 AM Rate Topic: -----

#16 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3576
  • View blog
  • Posts: 11,125
  • Joined: 05-May 12

Re: external fileupload window, programmically input path and file, then h

Posted 20 July 2012 - 10:14 AM

View Postsolarissf, on 20 July 2012 - 09:04 AM, said:

sorry... say what?


The browser I use treats files found on the local machine as more trusted and gives it more privileges. In general, I don't just take a random .htm file given to me and open it in my web browser. Who knows where that .htm has been?

It's like me handing you a .EXE file and saying "just run this so you can see the problem on your machine".

It's just not a safe computing practice.

This post has been edited by Skydiver: 20 July 2012 - 10:14 AM

Was This Post Helpful? 0
  • +
  • -

#17 solarissf  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 35
  • Joined: 27-March 12

Re: external fileupload window, programmically input path and file, then h

Posted 20 July 2012 - 11:44 AM

ok, just so I understand whats going on.

If I manager to complete this url.

then I would do something like this?

FileStream rdr = new FileStream(fileToUpload, FileMode.Open);
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(uploadUrl);
req.Method = "PUT"; // you might use "POST"
req.ContentLength = rdr.Length;
req.AllowWriteStreamBuffering = true;
Stream reqStream = req.GetRequestStream();

read data into stream

req.GetResponse();

Is that look semi-accurate? And if so, I do this from the LOADTRADES page. Do you know what I can expect if it works? When I manually hit LOADTRADES, there is a popup saying, "ARE YOU SURE", I hit yes. Then a confirmation message comes on screen. What will this method look like on success?

And one more thing, when I hit LOAD, there are some validators to make sure data is in proper format. Does this skip those validations? And do I have to stream the data in a particular way to this method to work?

sorry for so many questions!
Was This Post Helpful? 0
  • +
  • -

#18 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3576
  • View blog
  • Posts: 11,125
  • Joined: 05-May 12

Re: external fileupload window, programmically input path and file, then h

Posted 20 July 2012 - 01:26 PM

Sort of.

Take a close look at the <form> element on that page. It wants a POST rather than a GET.

You don't do this "from" a page. You POST to, or GET from a URL.

On success, you should get back a response from the server that is the next page to render.

Yes, this skips all the validators. You are talking directly to the server. The validators are just running client side.

Read the blog post referred to in the stackoverflow question that talks about building the multipart/form-data for file uploads: http://www.paraesthe...webrequest.aspx

I think it won't hurt if you take time to familiarize yourself with how the HTTP protocol works. I can only say that I know it in general, but I can't say that I grok it yet. Maybe you can teach me afterwards.

This post has been edited by Skydiver: 20 July 2012 - 02:07 PM

Was This Post Helpful? 2
  • +
  • -

#19 solarissf  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 35
  • Joined: 27-March 12

Re: external fileupload window, programmically input path and file, then h

Posted 23 July 2012 - 05:19 AM

thanks for all your help skydiver. With regards to the other post... I was trying to whiddle down all my options for accomplishing my task. I apologize if it was to similar. As you can tell I'm still learning and I was just looking for the first option that I could understand. As for this http request I decided to keep trying to go through the intended on validators this way I don't upload something that is incorrect.

And for that moderators response to my other post. I didn't see where all the hostility came from. Why should someone assume I'm doing something wrong? I hope I adaquately explained my goal and hope you could see it had nothing to do what that guy was talking about. A simple clarification would have been a bit more mature than blasting a post accussing of wrong doing. Anyway, I appreciate your help and everyonce else on this website. And I will take your advice a read up a but more on http protocol.
I guess a few people ruin it for everyone.
Was This Post Helpful? 0
  • +
  • -

#20 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3576
  • View blog
  • Posts: 11,125
  • Joined: 05-May 12

Re: external fileupload window, programmically input path and file, then h

Posted 23 July 2012 - 05:43 AM

The DIC culture is very sensitive about particular topics that could be used for mischief. Off top of my head, taboo subjects are: keyloggers, spoofing blue screens, spam bots, things that automate clicking buttons on UI that you don't own, or sending keystrokes to windows you don't own.

This post has been edited by Skydiver: 23 July 2012 - 05:44 AM

Was This Post Helpful? 0
  • +
  • -

#21 solarissf  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 35
  • Joined: 27-March 12

Re: external fileupload window, programmically input path and file, then h

Posted 23 July 2012 - 05:45 AM

just for my education, whats a keylogger?
Was This Post Helpful? 0
  • +
  • -

#22 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3576
  • View blog
  • Posts: 11,125
  • Joined: 05-May 12

Re: external fileupload window, programmically input path and file, then h

Posted 23 July 2012 - 06:45 AM

keylogger: http://en.wikipedia....ystroke_logging
Was This Post Helpful? 0
  • +
  • -

#23 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3576
  • View blog
  • Posts: 11,125
  • Joined: 05-May 12

Re: external fileupload window, programmically input path and file, then h

Posted 23 July 2012 - 06:55 AM

View PostSkydiver, on 23 July 2012 - 05:43 AM, said:

The DIC culture is very sensitive about particular topics that could be used for mischief. Off top of my head, taboo subjects are: keyloggers, spoofing blue screens, spam bots, things that automate clicking buttons on UI that you don't own, or sending keystrokes to windows you don't own.


View Postsolarissf, on 19 July 2012 - 04:14 PM, said:

Hello All,

I'm using c# winform. Using webbrowser.control I have logged into a website and navigated around to a particular section. Now I get to the part where I want to upload a file. I am able to "HIT" the UPLOAD button on this website, and the BROWSE button. A normal FileUpload box pops up...
any idea how I can enter in the path and filename into the box, and hit OK all using code?

I hope I am explaining clear... the pop up window is in front of me, now I want to select the file in code.

Thanks in advance!!


:whistling:
Was This Post Helpful? 0
  • +
  • -

#24 solarissf  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 35
  • Joined: 27-March 12

Re: external fileupload window, programmically input path and file, then h

Posted 23 July 2012 - 06:56 AM

ha, okay I understand.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2