473,383 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Upload documents using http

Hello.

How do I upload a document using http?

I see that .net has the system.web namespace but I cant find any
examples on how to use it... I'm not very experienced in .net.

Thank you very much for any contribution to my problem :)

neoret

May 5 '06 #1
2 1267
The System.Net.WebClient class should help you out a bunch.
http://msdn2.microsoft.com/en-us/lib...webclient.aspx

by default it will use an HTTP PUT but you can also use this to post data to
a form

Cheers,

Greg
<ei*******@gmail.com> wrote in message
news:11**********************@y43g2000cwc.googlegr oups.com...
Hello.

How do I upload a document using http?

I see that .net has the system.web namespace but I cant find any
examples on how to use it... I'm not very experienced in .net.

Thank you very much for any contribution to my problem :)

neoret

May 5 '06 #2
ei*******@gmail.com wrote:
Hello.

How do I upload a document using http?

I see that .net has the system.web namespace but I cant find any
examples on how to use it... I'm not very experienced in .net.

Thank you very much for any contribution to my problem :)

neoret


this example reads a text file from a remote site

using System;
using System.IO;
using System.Windows.Forms;
using System.Configuration;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Reflection;
using System.Runtime.Remoting;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Web;

namespace test
{
class remoteread
{
// static string Method = "MainAppForm";
static string methodname = "main";

[STAThread]
static void Main()
{
string RemoteFolder = @"http://yoursite.com/";
string RemoteFile = "yourfile.txt";
string url = RemoteFolder + RemoteFile;
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();
StreamReader sr = new StreamReader(webResponse.GetResponseStream(), Encoding.ASCII);
string filecontent;
filecontent = sr.ReadLine();

// Create a local StreamWriter here and write one line at a time in the loop

while (filecontent.Length > 0)
{
// Write to your local file here
filecontent = sr.ReadLine();
}
sr.close();
}
}
}

hope this helps



May 5 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Prakash | last post by:
Hi, We face problems uploading excel (with macros) documents using HTML File Upload. The file contents are corrupted while viewing the same. However, we are able to upload excel (w/o. macros)...
3
by: Kitt Langkilde | last post by:
Please Help. I run my applications perfectly, can make changes to my database, but I cannot upload Documents or Pictures Etc. Etc. Can anyone help me. I was able to with my Windows ME OS. I...
8
by: Dean Speir | last post by:
Hi... I've been referred to this Newsgroup by the W3C Markup Validator FAQ. I've been happily using this Validator <http://validator.w3.org> for the past 18 months with great success, but...
6
by: Varun_789 | last post by:
hello friends, i am developing an application in which i want to upload an image from clients hard drive(local hard drive) to the server. i mean the application should provide the user with the...
0
by: Kannan | last post by:
Hello, I was trying to upload a local file on a client machine to a sharepoint folder using the WebClient object. This method is present in a client side DLL. I need to upload the document using...
5
by: Seok Bee | last post by:
Dear Experts, I currently trying to use the FileUpload control from asp.net 2.0 to upload files. The uploading of the file I would like to store it in the Access Database. Unfortunately, I've no...
3
by: Stephan | last post by:
Hi all, I am new to access and I face the following "issue": I would like to create a database, to which users can upload files (=pdf, doc, xls...). The files shall be stored locally on a...
6
by: =?ISO-8859-1?Q?J=F8rn?= Dahl-Stamnes | last post by:
I have a strange problem when uploading a PDF document to a web-server. When I try this to a web-server running Apache 2 on a FC 4, it fails. Firefox says that the document contain no data. If I...
2
by: torbjorn.maro | last post by:
I'm the developer of an enterprise level web application that among other things handles documents. The documents are stored in a database. There is now simple functionality to check out and...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.