473,666 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1276
The System.Net.WebC lient 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*******@gmai l.com> wrote in message
news:11******** **************@ y43g2000cwc.goo glegroups.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.Configur ation;
using System.Drawing;
using System.Collecti ons;
using System.Componen tModel;
using System.Data;
using System.Reflecti on;
using System.Runtime. Remoting;
using System.Net;
using System.Net.Sock ets;
using System.Text;
using System.Web;

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

[STAThread]
static void Main()
{
string RemoteFolder = @"http://yoursite.com/";
string RemoteFile = "yourfile.t xt";
string url = RemoteFolder + RemoteFile;
HttpWebRequest webRequest = (HttpWebRequest )WebRequest.Cre ate(url);
HttpWebResponse webResponse = (HttpWebRespons e)webRequest.Ge tResponse();
StreamReader sr = new StreamReader(we bResponse.GetRe sponseStream(), Encoding.ASCII) ;
string filecontent;
filecontent = sr.ReadLine();

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

while (filecontent.Le ngth > 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
5820
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) documents successfully. Is there anything we have to take care of, while handling uploads of excel documents with macros? Thanks in advance,
3
1981
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 now run Windows 2000 Kitt
8
3102
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 suddenly I cannot get it to "read" my HTML documents by the "Validate by File Upload" method. It keeps giving me the following message: Sorry, I am unable to validate this document
6
12115
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 the faliclity to click on LoadPic button to open a Open File Dialog on his/her system, then allows the user to browse to the actually image and once the user is done, by clicking on Send button, sends the image to the server
0
1275
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 NTLM authentication. The method does not report any errors but the document does not appear in the folder. Here are the the two code snippets that I am working on and tested
5
6570
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 idea how I can do that. Can anyone provide me some solution by writing the code in vb.net? Many thanks in advance. Regards,
3
22284
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 server. The database needs to be accessed via Access form (no html, asp,...) as we don't have an internal web server running. I would like to create a form that allows the user to browse his local harddrive, select the file and upload it directly...
6
3324
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 upload it to a different web-server running RH 7.3 (an internal test-webserver), it works OK. The PDF document is created by OpenOffice 2.0 from a MS Word document. I have also had it converted to PDF in MS Word that could create PDF documents....
2
1847
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 download the document. This is done my a normal response to the browser, streaming the document. The user then gets the normal option to 'open', 'save' or 'cancel' til downloaded file. Normal usage would be to save the file to a known location, open...
21
34389
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 obvious of which is the sharing of files. For example, you upload images to a server to share them with other people over the Internet. Perl comes ready equipped for uploading files via the CGI.pm module, which has long been a core module and allows users...
0
8352
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8780
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7378
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6189
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5661
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4358
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2765
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2005
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.