TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mega Anaska
NA
144
35.9k
Transfer Image to another web
Sep 16 2018 10:37 PM
Hi guys, I uploaded a file and want to save it in local and another web with same network , is it possible ? like I upload a picture and save it on http://199.178.100.508/webProfil ? please help me. I use web form asp.net not web API. I tried
//string remoteUrl = "http://192.168.100.226/bjbcorpadmin/images";
//string formdataTemplate = "Content-Disposition: form-data; filename=\"{0}\";\r\nContent-Type: image/jpg\r\n\r\n";
//string boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
//byte[] boundarybytes = Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n");
//HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(remoteUrl);
//httpRequest.ServicePoint.Expect100Continue = false;
//httpRequest.Method = "POST";
//httpRequest.ContentType = "multipart/form-data; boundary=" + boundary;
//using (FileStream filestream = new FileStream(savePath, FileMode.Open, FileAccess.Read, FileShare.Read))
//{
// using (Stream requestStream = httpRequest.GetRequestStream())
// {
// requestStream.Write(boundarybytes, 0, boundarybytes.Length);
// string formitem = string.Format(formdataTemplate, Path.GetFileName(savePath));
// byte[] formbytes = Encoding.UTF8.GetBytes(formitem);
// requestStream.Write(formbytes, 0, formbytes.Length);
// byte[] buffer = new byte[1024 * 4];
// int bytesLeft = 0;
// while ((bytesLeft = filestream.Read(buffer, 0, buffer.Length)) > 0)
// {
// requestStream.Write(buffer, 0, bytesLeft);
// }
// filestream.CopyTo(requestStream);
// }
//}
//try
//{
// using (HttpWebResponse response = (HttpWebResponse)httpRequest.GetResponse()) { }
// Console.WriteLine("Success");
//}
//catch (Exception ex)
//{
// throw;
//}
but was error.. please help me
Reply
Answers (
1
)
how to create digital sihnature
Excel file data not getting inserted into SQL database.