Re: File Upload
- From: "Elton W" <EltonW@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 6 Jul 2005 05:43:02 -0700
Hi Sunil,
I’m not very familiar with C++. However, you can think about to build a
small .NET application to upload file. That will be easy for processing the
file on server-side. And it is not difficult to call the .NET program from
your C++ application.
Or you can make .NET component to perform upload file function, then call
the .NET component from COM
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/cominterop.asp).
HTH
Elton
"Neo" wrote:
> hi elton,
>
> the client is in C++
>
> The details are as follows. There is a desktop application in MFC, and
> i am building a web interface for that application in ASP.NET. I have
> to upload a file from the C++ Application to ASP.NET web application.
>
> I am using Multipart/form-data to transfer the file, as sending it as a
> HTTP request in synchronous mode hangs my C++ application. What is
> happening is that i am receiving the file on the server which i am
> storing to the disk using request.inputstream.
>
> What happens is that the boundary and the Content-Disposition :
> application/octet-stream comes in the binary inputstream which i am
> trying to filter. What i did was that i saved the file on the server
> and then read it line by line using streamreader and streamwriter, but
> it gives me some encoding problem.
>
> So i am looking at ... can a file be uploaded from C++ Desktop
> application to a ASP.NET web server application without the junk
> content in the stream, i.e. only the file (complete as it was sent), or
> is there any way to parse binary data??
>
> All help is appreciated ... thanks for the same.
>
> Regards
>
> Sunil
>
> Elton W wrote:
> > Hi Neo,
> >
> > You can try
> >
> > System.Web.HttpPostedFile file = Request.Files[0]; // suppose there is only
> > one file
> > //or
> > System.Web.HttpPostedFile file = Request.Files["file_name"];
> >
> >
> > On client-side you can use
> >
> > System.Net.WebClient client = new WebClient();
> > byte[] data = client.UploadFile(url,"POST",fileName);
> >
> > To send file to server.
> >
> >
> >
> > HTH
> >
> > Elton Wang
> > elton_wang@xxxxxxxxxxx
> >
> >
> >
> >
> > "Neo" wrote:
> >
> > > Hello,
> > >
> > > I am receiving a file as a binary stream from a C++ Client Application.
> > > >From the application, the file is being sent as a
> > > "Multipart/form-data".
> > >
> > > I want to receive this file on the server, for which i am using
> > > Request.Inputstream and reading it into a byte array. This is not
> > > working as it is coupling the binary content with some Boundary and
> > > text such as "Content-Disposition:
> > > form-data; name="upload_file"; filename="C:\dustbin\test.bin"
> > > Content-Type: "application/octet-stream"
> > >
> > > Is there any way in ASP.NET by which i can read a File being sent from
> > > an Application (not a HtmlInputFileControl), can be read, without the
> > > unnecessary data/ or any way in which i can filter the binary data.
> > >
> > > Please help, i am stuck big time on this. This feature is imperative
> > > for the project :(
> > >
> > > Requesting help.
> > >
> > > Regards
> > >
> > > Sunil Jambekar
> > >
> > >
>
>
.
- References:
- File Upload
- From: Neo
- RE: File Upload
- From: Elton W
- Re: File Upload
- From: Neo
- File Upload
- Prev by Date: Re: FormsAuthentication.SignOut() not working in UserControl
- Next by Date: Re: HTML Paragraph question
- Previous by thread: Re: File Upload
- Next by thread: Re: File Upload
- Index(es):
Relevant Pages
|