C # upload files through HTTP,

Source: Internet
Author: User

C # upload files through HTTP,

Code:

/// <Summary> /// upload a file over Http /// </summary> public static string HttpUploadFile (string url, string path) {// set the parameter HttpWebRequest request = WebRequest. create (url) as HttpWebRequest; CookieContainer cookieContainer = new CookieContainer (); request. cookieContainer = cookieContainer; request. allowAutoRedirect = true; request. method = "POST"; string boundary = DateTime. now. ticks. toString ("X"); // random separator request. contentType = "multipart/form-data; charset = UTF-8; boundary =" + boundary; byte [] itemBoundaryBytes = Encoding. UTF8.GetBytes ("\ r \ n --" + boundary + "\ r \ n"); byte [] endBoundaryBytes = Encoding. UTF8.GetBytes ("\ r \ n --" + boundary + "-- \ r \ n"); int pos = path. lastIndexOf ("\"); string fileName = path. substring (pos + 1); // request header information StringBuilder sbHeader = new StringBuilder (string. format ("Content-Disposition: form-data; name = \" file \ "; filename = \" {0} \ "\ r \ nContent-Type: application/octet-stream \ r \ n ", fileName); byte [] postHeaderBytes = Encoding. UTF8.GetBytes (sbHeader. toString (); FileStream fs = new FileStream (path, FileMode. open, FileAccess. read); byte [] bArr = new byte [fs. length]; fs. read (bArr, 0, bArr. length); fs. close (); Stream postStream = request. getRequestStream (); postStream. write (itemBoundaryBytes, 0, itemBoundaryBytes. length); postStream. write (postHeaderBytes, 0, postHeaderBytes. length); postStream. write (bArr, 0, bArr. length); postStream. write (endBoundaryBytes, 0, endBoundaryBytes. length); postStream. close (); // send the request and obtain the response data HttpWebResponse response = request. getResponse () as HttpWebResponse; // wait until request. the GetResponse () program starts to send the Post request Stream instream = response to the target webpage. getResponseStream (); StreamReader sr = new StreamReader (instream, Encoding. UTF8); // returned result webpage (html) code string content = sr. readToEnd (); return content ;}View Code

Code for receiving a file:

Using System; using System. web; namespace SWX {public partial class test2: System. web. UI. page {protected void Page_Load (object sender, EventArgs e) {HttpPostedFile file = Request. files [0]; file. saveAs (MapPath ("\ UploadFile \" + file. fileName); Response. write ("Success \ r \ n ");}}}View Code

 


CC real name

The story of LULU and King Arthur and the real name Analysis of CC
According to a strong analysis on the Internet.
Although lancot appeared in the first season
But he never imagined it with Arthur.
Because it is the name of the body, I don't think much about it.

Now I saw R2. seeing the name of the Round Table knight, the king opened his eyes with a pair of geass.
Only then can we realize that the essence of ruuxiu is actually a variant of Arthur's story...
If this is true, the true name of c. c is clear ..

The introduction of the Royal Family Name "briannia" refers to a relatively old saying in Britain. The "British kings" One hundred and fifty years ago used the British annia, and this book refers to the story of King Arthur's round table knight, the number of Round Table Knights ranges from.
In this tutorial, the Round Table server has a minimum of 12

In the legend of King Arthur, lancelot is a knight who betrayed the king because he fell in love with the king.
And he is an orphan of a young father

Let's look at the name of zhuque Shu Mu.
Pivot means key or important.
Zhuque now seems to be no different from the species of birds that can survive the burning of death.
So: OK: zhumu zhuque is a young father who will betray with love as an excuse. It plays an important role in this film, and how can he play an undead role...

King Arthur disappeared after a duel with his son mordred (in fact, he died). The reason for the duel is that this son wants to gain a throne. Please note that, king Arthur knew that his son would have killed him shortly after his birth (a legend in the west) but did not kill him. Instead, he continued to raise him.

Ruuxiu's name is very interesting.
Japanese is written in Japanese.
However, the official western style is: Lelouch Lamperouge
Let's take a look at this sentence.
Le louche explains abnormal behavior in the eyes and greedy behavior in the eyes.
Lampe rouge is a red light or lamp.
The son who killed Arthur was named Mordred.
The split shows that Mord is related to death + Red
OK: Lu luxiu is an eye that emits abnormal red light and greedy character (every time I play tactics, I want to use all the methods, and the result is reversed by the enemy's strong role ), sending is spreading the message of death to the prince who targeted his father.

Kalian
The old surname "Red Moon" in Area 11 refers to ominous things. Normally, attackers like to mount the moon at night.
The last name of the empire is Stadtfield, which indicates the field of the municipal council.
Her name, Kallen, was directly translated into Karine or Hualien for reference by the translation team.
In fact, this word means that it is a verb to hold it tightly with claws.
Everyone should know the explanation of her body, that is, the spark of a huge explosion.

OK: So cailian is a very honorable and non-invasive entity in the empire. However, it is always carrying out ominous activities in the dark. It is a fire of character and is good at operating a body that can hold the enemy tightly with claws.

So what?
Name of c. c. As a key character
It will certainly be associated with her miserable situation.
And it must be in touch with Arthur's background.
Because c. c. once belonged to the holy kingdom of Britain and then escaped.
That is to say, Arthur got and lost things.
This is not a human thing for Arthur.
And it can be related to the letter C.

Then only Arthur's first sword is Calibur.
The other name is Sword of the Stone before King Arthur gets it.
Later, it was broken in a duel that does not conform to the spirit of the server guard.

Caliburia is highly likely to become a personal name.
Considering that c. c. is a girl, it may be changed
Caliburian or Clirburess
Because C. C.'s real name is five syllables (11 episodes in the first season)
And... the remaining full text>

CC real name

The story of LULU and King Arthur and the real name Analysis of CC
According to a strong analysis on the Internet.
Although lancot appeared in the first season
But he never imagined it with Arthur.
Because it is the name of the body, I don't think much about it.

Now I saw R2. seeing the name of the Round Table knight, the king opened his eyes with a pair of geass.
Only then can we realize that the essence of ruuxiu is actually a variant of Arthur's story...
If this is true, the true name of c. c is clear ..

The introduction of the Royal Family Name "briannia" refers to a relatively old saying in Britain. The "British kings" One hundred and fifty years ago used the British annia, and this book refers to the story of King Arthur's round table knight, the number of Round Table Knights ranges from.
In this tutorial, the Round Table server has a minimum of 12

In the legend of King Arthur, lancelot is a knight who betrayed the king because he fell in love with the king.
And he is an orphan of a young father

Let's look at the name of zhuque Shu Mu.
Pivot means key or important.
Zhuque now seems to be no different from the species of birds that can survive the burning of death.
So: OK: zhumu zhuque is a young father who will betray with love as an excuse. It plays an important role in this film, and how can he play an undead role...

King Arthur disappeared after a duel with his son mordred (in fact, he died). The reason for the duel is that this son wants to gain a throne. Please note that, king Arthur knew that his son would have killed him shortly after his birth (a legend in the west) but did not kill him. Instead, he continued to raise him.

Ruuxiu's name is very interesting.
Japanese is written in Japanese.
However, the official western style is: Lelouch Lamperouge
Let's take a look at this sentence.
Le louche explains abnormal behavior in the eyes and greedy behavior in the eyes.
Lampe rouge is a red light or lamp.
The son who killed Arthur was named Mordred.
The split shows that Mord is related to death + Red
OK: Lu luxiu is an eye that emits abnormal red light and greedy character (every time I play tactics, I want to use all the methods, and the result is reversed by the enemy's strong role ), sending is spreading the message of death to the prince who targeted his father.

Kalian
The old surname "Red Moon" in Area 11 refers to ominous things. Normally, attackers like to mount the moon at night.
The last name of the empire is Stadtfield, which indicates the field of the municipal council.
Her name, Kallen, was directly translated into Karine or Hualien for reference by the translation team.
In fact, this word means that it is a verb to hold it tightly with claws.
Everyone should know the explanation of her body, that is, the spark of a huge explosion.

OK: So cailian is a very honorable and non-invasive entity in the empire. However, it is always carrying out ominous activities in the dark. It is a fire of character and is good at operating a body that can hold the enemy tightly with claws.

So what?
Name of c. c. As a key character
It will certainly be associated with her miserable situation.
And it must be in touch with Arthur's background.
Because c. c. once belonged to the holy kingdom of Britain and then escaped.
That is to say, Arthur got and lost things.
This is not a human thing for Arthur.
And it can be related to the letter C.

Then only Arthur's first sword is Calibur.
The other name is Sword of the Stone before King Arthur gets it.
Later, it was broken in a duel that does not conform to the spirit of the server guard.

Caliburia is highly likely to become a personal name.
Considering that c. c. is a girl, it may be changed
Caliburian or Clirburess
Because C. C.'s real name is five syllables (11 episodes in the first season)
And... the remaining full text>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.