Connecting Tech Pros Worldwide Forums | Help | Site Map

asp.net form to send a request to a put request

eswanson
Guest
 
Posts: n/a
#1: Nov 18 '05
I have a web page I need to post a file plus some other fields to it. How
can I do this from a asp.net page. I know I can send individual fields to the
other page, but how do I send a file to the other page, or is there something
else like a stream which will be like a file. I am attempting to get a way
from writing out a file and then having to give the page that I am posting to
the file name. Instead I would like to just from asp.net post to the other
HTML page, the information, plus this file without writing a file out first.

Jeffrey Palermo [MCP]
Guest
 
Posts: n/a
#2: Nov 18 '05

re: asp.net form to send a request to a put request


You would do this exactly the same as you would do it in regular HTML
without ASP.NET. In fact, you don't have to use server controls for this.
You can use a normal form and normal <input type="file"/>, <input
type="submit"/> controls, and set the action of the form to the other page.
Don't use a runat="server" form. A regular form will do. Then in the page
you post to, just retrieve the form values.

Best regards,
Jeffrey Palermo

"eswanson" <eswanson@discussions.microsoft.com> wrote in message
news:CDA3312F-AA93-4821-835C-C07E2503C2E2@microsoft.com...[color=blue]
> I have a web page I need to post a file plus some other fields to it. How
> can I do this from a asp.net page. I know I can send individual fields to[/color]
the[color=blue]
> other page, but how do I send a file to the other page, or is there[/color]
something[color=blue]
> else like a stream which will be like a file. I am attempting to get a[/color]
way[color=blue]
> from writing out a file and then having to give the page that I am posting[/color]
to[color=blue]
> the file name. Instead I would like to just from asp.net post to the[/color]
other[color=blue]
> HTML page, the information, plus this file without writing a file out[/color]
first.


eswanson
Guest
 
Posts: n/a
#3: Nov 18 '05

re: asp.net form to send a request to a put request


Hi Jeff,

Here is an example that does this in HTML, but I would like to do this in
asp.net, but I do not want to create the file first, instead I would like to
somehow stream the data to this post instead of writing out the file first
and then having the user select the file and transfering it up to the host
site. Is this possible?

Here is the current html:

<form method="post" enctype="multipart/form-data"
action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload"/>
<!--<form method="post" enctype="multipart/form-data"
action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload">-->
XML: <input type="file" name="xml" id="xml="><br>
Batch ID: <input type="text" name="batchid" id="batchid="><br>
Program Number: <input type="text" name="programnumber"
id="programnumber="><br>
<input type="submit">

I am attempting to automated the input type="file", instead I would like to
stream the file data from an asp.net page without first creating a file and
then having the user select this file and transmitting it up to the other
site. What other options do I have instead of creating the file first or is
it possible to tell the input type='file' exactly what the file is and where
it is?

Thanks

Eric

"Jeffrey Palermo [MCP]" wrote:
[color=blue]
> You would do this exactly the same as you would do it in regular HTML
> without ASP.NET. In fact, you don't have to use server controls for this.
> You can use a normal form and normal <input type="file"/>, <input
> type="submit"/> controls, and set the action of the form to the other page.
> Don't use a runat="server" form. A regular form will do. Then in the page
> you post to, just retrieve the form values.
>
> Best regards,
> Jeffrey Palermo
>
> "eswanson" <eswanson@discussions.microsoft.com> wrote in message
> news:CDA3312F-AA93-4821-835C-C07E2503C2E2@microsoft.com...[color=green]
> > I have a web page I need to post a file plus some other fields to it. How
> > can I do this from a asp.net page. I know I can send individual fields to[/color]
> the[color=green]
> > other page, but how do I send a file to the other page, or is there[/color]
> something[color=green]
> > else like a stream which will be like a file. I am attempting to get a[/color]
> way[color=green]
> > from writing out a file and then having to give the page that I am posting[/color]
> to[color=green]
> > the file name. Instead I would like to just from asp.net post to the[/color]
> other[color=green]
> > HTML page, the information, plus this file without writing a file out[/color]
> first.
>
>
>[/color]
Jeffrey Palermo [MCP]
Guest
 
Posts: n/a
#4: Nov 18 '05

re: asp.net form to send a request to a put request


Eric,
I'm not sure I know exactly what you are trying to do, but if the file
is coming from a user's machine, you can't automatically grab it. That
would be a security issue. If the file is originating on the server, then
there is no need for one page to grab it and post it to another page. The
second page could just use the absolute path on the server or the network to
open the file.

Try reposting this question to the newsgroup, be more specific.

Best regards,
Jeffrey Palermo

"eswanson" <eswanson@discussions.microsoft.com> wrote in message
news:14C47C45-5C8A-450D-BAFE-2A8141E850B8@microsoft.com...[color=blue]
> Hi Jeff,
>
> Here is an example that does this in HTML, but I would like to do this in
> asp.net, but I do not want to create the file first, instead I would like[/color]
to[color=blue]
> somehow stream the data to this post instead of writing out the file first
> and then having the user select the file and transfering it up to the host
> site. Is this possible?
>
> Here is the current html:
>
> <form method="post" enctype="multipart/form-data"
> action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload"/>
> <!--<form method="post" enctype="multipart/form-data"
> action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload">-->
> XML: <input type="file" name="xml" id="xml="><br>
> Batch ID: <input type="text" name="batchid" id="batchid="><br>
> Program Number: <input type="text" name="programnumber"
> id="programnumber="><br>
> <input type="submit">
>
> I am attempting to automated the input type="file", instead I would like[/color]
to[color=blue]
> stream the file data from an asp.net page without first creating a file[/color]
and[color=blue]
> then having the user select this file and transmitting it up to the other
> site. What other options do I have instead of creating the file first or[/color]
is[color=blue]
> it possible to tell the input type='file' exactly what the file is and[/color]
where[color=blue]
> it is?
>
> Thanks
>
> Eric
>
> "Jeffrey Palermo [MCP]" wrote:
>[color=green]
> > You would do this exactly the same as you would do it in regular HTML
> > without ASP.NET. In fact, you don't have to use server controls for[/color][/color]
this.[color=blue][color=green]
> > You can use a normal form and normal <input type="file"/>, <input
> > type="submit"/> controls, and set the action of the form to the other[/color][/color]
page.[color=blue][color=green]
> > Don't use a runat="server" form. A regular form will do. Then in the[/color][/color]
page[color=blue][color=green]
> > you post to, just retrieve the form values.
> >
> > Best regards,
> > Jeffrey Palermo
> >
> > "eswanson" <eswanson@discussions.microsoft.com> wrote in message
> > news:CDA3312F-AA93-4821-835C-C07E2503C2E2@microsoft.com...[color=darkred]
> > > I have a web page I need to post a file plus some other fields to it.[/color][/color][/color]
How[color=blue][color=green][color=darkred]
> > > can I do this from a asp.net page. I know I can send individual fields[/color][/color][/color]
to[color=blue][color=green]
> > the[color=darkred]
> > > other page, but how do I send a file to the other page, or is there[/color]
> > something[color=darkred]
> > > else like a stream which will be like a file. I am attempting to get[/color][/color][/color]
a[color=blue][color=green]
> > way[color=darkred]
> > > from writing out a file and then having to give the page that I am[/color][/color][/color]
posting[color=blue][color=green]
> > to[color=darkred]
> > > the file name. Instead I would like to just from asp.net post to the[/color]
> > other[color=darkred]
> > > HTML page, the information, plus this file without writing a file out[/color]
> > first.
> >
> >
> >[/color][/color]


eswanson
Guest
 
Posts: n/a
#5: Nov 18 '05

re: asp.net form to send a request to a put request


Please read the entire reponse, hopefully this clears up your questions.

The data used that needs to go into the batchupload page comes from a
server. My problem is that currently I write a file to the server and then
the user has to pick this file and send it up to the batchupload page. The
batchupload page is not one of our page, instead it is another company's
page. This is there interface to do batch processing. We have no control
over it. We just call this page "batchupload" with a file and other
parameters. I am attempting to call the page "batchupload" and send fill in
the parameters with out first creating the file. Is this possible? Do you
understand our problem.

First batchupload is a page from another company. It is used for their
batch processing. Request parameters include a file <html input type=file> -
does this have to be a file or some other data stream stored on the page and
then sent over to this page?

The html page I sent you would be a page that was written for us to
communicate with the batchupload page. I can hard code all of the other
parameters except for the input type=file. Instead of writing out a file, I
would like to buffer the file data into an asp.net page and then just send
all of the information at once over to the "batchupload" page.

I know that I can use
httpppost(http://www.othercompany.com/batchupload?batchid='123'&programnumber='ABC'&xml= ?????????)
How do I specify the xml, since this variable is a file. What has to be in
the data stream of xml, so that it appears to be a file, but is actually a
character string?

Hopefully this clears up the confusion.

Thanks

Eric

"Jeffrey Palermo [MCP]" wrote:
[color=blue]
> Eric,
> I'm not sure I know exactly what you are trying to do, but if the file
> is coming from a user's machine, you can't automatically grab it. That
> would be a security issue. If the file is originating on the server, then
> there is no need for one page to grab it and post it to another page. The
> second page could just use the absolute path on the server or the network to
> open the file.
>
> Try reposting this question to the newsgroup, be more specific.
>
> Best regards,
> Jeffrey Palermo
>
> "eswanson" <eswanson@discussions.microsoft.com> wrote in message
> news:14C47C45-5C8A-450D-BAFE-2A8141E850B8@microsoft.com...[color=green]
> > Hi Jeff,
> >
> > Here is an example that does this in HTML, but I would like to do this in
> > asp.net, but I do not want to create the file first, instead I would like[/color]
> to[color=green]
> > somehow stream the data to this post instead of writing out the file first
> > and then having the user select the file and transfering it up to the host
> > site. Is this possible?
> >
> > Here is the current html:
> >
> > <form method="post" enctype="multipart/form-data"
> > action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload"/>
> > <!--<form method="post" enctype="multipart/form-data"
> > action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload">-->
> > XML: <input type="file" name="xml" id="xml="><br>
> > Batch ID: <input type="text" name="batchid" id="batchid="><br>
> > Program Number: <input type="text" name="programnumber"
> > id="programnumber="><br>
> > <input type="submit">
> >
> > I am attempting to automated the input type="file", instead I would like[/color]
> to[color=green]
> > stream the file data from an asp.net page without first creating a file[/color]
> and[color=green]
> > then having the user select this file and transmitting it up to the other
> > site. What other options do I have instead of creating the file first or[/color]
> is[color=green]
> > it possible to tell the input type='file' exactly what the file is and[/color]
> where[color=green]
> > it is?
> >
> > Thanks
> >
> > Eric
> >
> > "Jeffrey Palermo [MCP]" wrote:
> >[color=darkred]
> > > You would do this exactly the same as you would do it in regular HTML
> > > without ASP.NET. In fact, you don't have to use server controls for[/color][/color]
> this.[color=green][color=darkred]
> > > You can use a normal form and normal <input type="file"/>, <input
> > > type="submit"/> controls, and set the action of the form to the other[/color][/color]
> page.[color=green][color=darkred]
> > > Don't use a runat="server" form. A regular form will do. Then in the[/color][/color]
> page[color=green][color=darkred]
> > > you post to, just retrieve the form values.
> > >
> > > Best regards,
> > > Jeffrey Palermo
> > >
> > > "eswanson" <eswanson@discussions.microsoft.com> wrote in message
> > > news:CDA3312F-AA93-4821-835C-C07E2503C2E2@microsoft.com...
> > > > I have a web page I need to post a file plus some other fields to it.[/color][/color]
> How[color=green][color=darkred]
> > > > can I do this from a asp.net page. I know I can send individual fields[/color][/color]
> to[color=green][color=darkred]
> > > the
> > > > other page, but how do I send a file to the other page, or is there
> > > something
> > > > else like a stream which will be like a file. I am attempting to get[/color][/color]
> a[color=green][color=darkred]
> > > way
> > > > from writing out a file and then having to give the page that I am[/color][/color]
> posting[color=green][color=darkred]
> > > to
> > > > the file name. Instead I would like to just from asp.net post to the
> > > other
> > > > HTML page, the information, plus this file without writing a file out
> > > first.
> > >
> > >
> > >[/color][/color]
>
>
>[/color]
Jeffrey Palermo [MCP]
Guest
 
Posts: n/a
#6: Nov 18 '05

re: asp.net form to send a request to a put request


Eric,
I've done a bit of research on this, and you need to use the
HttpWebRequest class in the System.Net namespace to create a custom web
request that will post a file to an external website. I found a class that
abstracts a lot of the code required:
http://www.c-sharpcorner.com/Code/20...DotNetBugs.asp
Pull this class into your project, and then it will just take a few lines of
code:
MultipartForm mp = new MultipartForm(http://localhost/AcceptFile.aspx);
mp.sendFile(@"c:\resetlog.txt");

I was able to send my file to a web page that accepted it as a client
upload. You can examine the code of MultipartForm for what code is actually
run. It gets a little bit hairy.

Best regards,

Jeffrey Palermo

"eswanson" <eswanson@discussions.microsoft.com> wrote in message
news:64B80D54-6848-467F-A296-9C763D24EE02@microsoft.com...[color=blue]
> Please read the entire reponse, hopefully this clears up your questions.
>
> The data used that needs to go into the batchupload page comes from a
> server. My problem is that currently I write a file to the server and[/color]
then[color=blue]
> the user has to pick this file and send it up to the batchupload page.[/color]
The[color=blue]
> batchupload page is not one of our page, instead it is another company's
> page. This is there interface to do batch processing. We have no control
> over it. We just call this page "batchupload" with a file and other
> parameters. I am attempting to call the page "batchupload" and send fill[/color]
in[color=blue]
> the parameters with out first creating the file. Is this possible? Do[/color]
you[color=blue]
> understand our problem.
>
> First batchupload is a page from another company. It is used for their
> batch processing. Request parameters include a file <html input[/color]
type=file> -[color=blue]
> does this have to be a file or some other data stream stored on the page[/color]
and[color=blue]
> then sent over to this page?
>
> The html page I sent you would be a page that was written for us to
> communicate with the batchupload page. I can hard code all of the other
> parameters except for the input type=file. Instead of writing out a file,[/color]
I[color=blue]
> would like to buffer the file data into an asp.net page and then just send
> all of the information at once over to the "batchupload" page.
>
> I know that I can use
>[/color]
httpppost(http://www.othercompany.com/batchupload?batchid='123'&programnumbe
r='ABC'&xml=?????????)[color=blue]
> How do I specify the xml, since this variable is a file. What has to be[/color]
in[color=blue]
> the data stream of xml, so that it appears to be a file, but is actually a
> character string?
>
> Hopefully this clears up the confusion.
>
> Thanks
>
> Eric
>
> "Jeffrey Palermo [MCP]" wrote:
>[color=green]
> > Eric,
> > I'm not sure I know exactly what you are trying to do, but if the[/color][/color]
file[color=blue][color=green]
> > is coming from a user's machine, you can't automatically grab it. That
> > would be a security issue. If the file is originating on the server,[/color][/color]
then[color=blue][color=green]
> > there is no need for one page to grab it and post it to another page.[/color][/color]
The[color=blue][color=green]
> > second page could just use the absolute path on the server or the[/color][/color]
network to[color=blue][color=green]
> > open the file.
> >
> > Try reposting this question to the newsgroup, be more specific.
> >
> > Best regards,
> > Jeffrey Palermo
> >
> > "eswanson" <eswanson@discussions.microsoft.com> wrote in message
> > news:14C47C45-5C8A-450D-BAFE-2A8141E850B8@microsoft.com...[color=darkred]
> > > Hi Jeff,
> > >
> > > Here is an example that does this in HTML, but I would like to do this[/color][/color][/color]
in[color=blue][color=green][color=darkred]
> > > asp.net, but I do not want to create the file first, instead I would[/color][/color][/color]
like[color=blue][color=green]
> > to[color=darkred]
> > > somehow stream the data to this post instead of writing out the file[/color][/color][/color]
first[color=blue][color=green][color=darkred]
> > > and then having the user select the file and transfering it up to the[/color][/color][/color]
host[color=blue][color=green][color=darkred]
> > > site. Is this possible?
> > >
> > > Here is the current html:
> > >
> > > <form method="post" enctype="multipart/form-data"
> > >[/color][/color][/color]
action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload"/>[color=blue][color=green][color=darkred]
> > > <!--<form method="post" enctype="multipart/form-data"
> > >[/color][/color][/color]
action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload">-->[color=blue][color=green][color=darkred]
> > > XML: <input type="file" name="xml" id="xml="><br>
> > > Batch ID: <input type="text" name="batchid" id="batchid="><br>
> > > Program Number: <input type="text" name="programnumber"
> > > id="programnumber="><br>
> > > <input type="submit">
> > >
> > > I am attempting to automated the input type="file", instead I would[/color][/color][/color]
like[color=blue][color=green]
> > to[color=darkred]
> > > stream the file data from an asp.net page without first creating a[/color][/color][/color]
file[color=blue][color=green]
> > and[color=darkred]
> > > then having the user select this file and transmitting it up to the[/color][/color][/color]
other[color=blue][color=green][color=darkred]
> > > site. What other options do I have instead of creating the file first[/color][/color][/color]
or[color=blue][color=green]
> > is[color=darkred]
> > > it possible to tell the input type='file' exactly what the file is and[/color]
> > where[color=darkred]
> > > it is?
> > >
> > > Thanks
> > >
> > > Eric
> > >
> > > "Jeffrey Palermo [MCP]" wrote:
> > >
> > > > You would do this exactly the same as you would do it in regular[/color][/color][/color]
HTML[color=blue][color=green][color=darkred]
> > > > without ASP.NET. In fact, you don't have to use server controls for[/color]
> > this.[color=darkred]
> > > > You can use a normal form and normal <input type="file"/>, <input
> > > > type="submit"/> controls, and set the action of the form to the[/color][/color][/color]
other[color=blue][color=green]
> > page.[color=darkred]
> > > > Don't use a runat="server" form. A regular form will do. Then in[/color][/color][/color]
the[color=blue][color=green]
> > page[color=darkred]
> > > > you post to, just retrieve the form values.
> > > >
> > > > Best regards,
> > > > Jeffrey Palermo
> > > >
> > > > "eswanson" <eswanson@discussions.microsoft.com> wrote in message
> > > > news:CDA3312F-AA93-4821-835C-C07E2503C2E2@microsoft.com...
> > > > > I have a web page I need to post a file plus some other fields to[/color][/color][/color]
it.[color=blue][color=green]
> > How[color=darkred]
> > > > > can I do this from a asp.net page. I know I can send individual[/color][/color][/color]
fields[color=blue][color=green]
> > to[color=darkred]
> > > > the
> > > > > other page, but how do I send a file to the other page, or is[/color][/color][/color]
there[color=blue][color=green][color=darkred]
> > > > something
> > > > > else like a stream which will be like a file. I am attempting to[/color][/color][/color]
get[color=blue][color=green]
> > a[color=darkred]
> > > > way
> > > > > from writing out a file and then having to give the page that I am[/color]
> > posting[color=darkred]
> > > > to
> > > > > the file name. Instead I would like to just from asp.net post to[/color][/color][/color]
the[color=blue][color=green][color=darkred]
> > > > other
> > > > > HTML page, the information, plus this file without writing a file[/color][/color][/color]
out[color=blue][color=green][color=darkred]
> > > > first.
> > > >
> > > >
> > > >[/color]
> >
> >
> >[/color][/color]


Jeffrey Palermo [MCP]
Guest
 
Posts: n/a
#7: Nov 18 '05

re: asp.net form to send a request to a put request


Eric,
Another, easier but less flexible way to do it is to use the WebClient
class:

Console.Write("\nPlease enter the URI to post data to : ");

String uriString = "http://localhost/WebApplication1/AcceptFile.aspx";

// Create a new WebClient instance.

WebClient myWebClient = new WebClient();

Console.WriteLine("\nPlease enter the fully qualified path of the file to be
uploaded to the URI");

string fileName = @"c:\upload.txt";

Console.WriteLine("Uploading {0} to {1} ...",fileName,uriString);

byte[] responseArray = myWebClient.UploadFile(uriString, "POST", fileName);


// Decode and display the response.

Console.WriteLine("\nResponse Received.The contents of the file uploaded
are: \n{0}",Encoding.ASCII.GetString(responseArray));

Console.ReadLine();



Best regards,

Jeffrey Palermo

"eswanson" <eswanson@discussions.microsoft.com> wrote in message
news:64B80D54-6848-467F-A296-9C763D24EE02@microsoft.com...[color=blue]
> Please read the entire reponse, hopefully this clears up your questions.
>
> The data used that needs to go into the batchupload page comes from a
> server. My problem is that currently I write a file to the server and[/color]
then[color=blue]
> the user has to pick this file and send it up to the batchupload page.[/color]
The[color=blue]
> batchupload page is not one of our page, instead it is another company's
> page. This is there interface to do batch processing. We have no control
> over it. We just call this page "batchupload" with a file and other
> parameters. I am attempting to call the page "batchupload" and send fill[/color]
in[color=blue]
> the parameters with out first creating the file. Is this possible? Do[/color]
you[color=blue]
> understand our problem.
>
> First batchupload is a page from another company. It is used for their
> batch processing. Request parameters include a file <html input[/color]
type=file> -[color=blue]
> does this have to be a file or some other data stream stored on the page[/color]
and[color=blue]
> then sent over to this page?
>
> The html page I sent you would be a page that was written for us to
> communicate with the batchupload page. I can hard code all of the other
> parameters except for the input type=file. Instead of writing out a file,[/color]
I[color=blue]
> would like to buffer the file data into an asp.net page and then just send
> all of the information at once over to the "batchupload" page.
>
> I know that I can use
>[/color]
httpppost(http://www.othercompany.com/batchupload?batchid='123'&programnumbe
r='ABC'&xml=?????????)[color=blue]
> How do I specify the xml, since this variable is a file. What has to be[/color]
in[color=blue]
> the data stream of xml, so that it appears to be a file, but is actually a
> character string?
>
> Hopefully this clears up the confusion.
>
> Thanks
>
> Eric
>
> "Jeffrey Palermo [MCP]" wrote:
>[color=green]
> > Eric,
> > I'm not sure I know exactly what you are trying to do, but if the[/color][/color]
file[color=blue][color=green]
> > is coming from a user's machine, you can't automatically grab it. That
> > would be a security issue. If the file is originating on the server,[/color][/color]
then[color=blue][color=green]
> > there is no need for one page to grab it and post it to another page.[/color][/color]
The[color=blue][color=green]
> > second page could just use the absolute path on the server or the[/color][/color]
network to[color=blue][color=green]
> > open the file.
> >
> > Try reposting this question to the newsgroup, be more specific.
> >
> > Best regards,
> > Jeffrey Palermo
> >
> > "eswanson" <eswanson@discussions.microsoft.com> wrote in message
> > news:14C47C45-5C8A-450D-BAFE-2A8141E850B8@microsoft.com...[color=darkred]
> > > Hi Jeff,
> > >
> > > Here is an example that does this in HTML, but I would like to do this[/color][/color][/color]
in[color=blue][color=green][color=darkred]
> > > asp.net, but I do not want to create the file first, instead I would[/color][/color][/color]
like[color=blue][color=green]
> > to[color=darkred]
> > > somehow stream the data to this post instead of writing out the file[/color][/color][/color]
first[color=blue][color=green][color=darkred]
> > > and then having the user select the file and transfering it up to the[/color][/color][/color]
host[color=blue][color=green][color=darkred]
> > > site. Is this possible?
> > >
> > > Here is the current html:
> > >
> > > <form method="post" enctype="multipart/form-data"
> > >[/color][/color][/color]
action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload"/>[color=blue][color=green][color=darkred]
> > > <!--<form method="post" enctype="multipart/form-data"
> > >[/color][/color][/color]
action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload">-->[color=blue][color=green][color=darkred]
> > > XML: <input type="file" name="xml" id="xml="><br>
> > > Batch ID: <input type="text" name="batchid" id="batchid="><br>
> > > Program Number: <input type="text" name="programnumber"
> > > id="programnumber="><br>
> > > <input type="submit">
> > >
> > > I am attempting to automated the input type="file", instead I would[/color][/color][/color]
like[color=blue][color=green]
> > to[color=darkred]
> > > stream the file data from an asp.net page without first creating a[/color][/color][/color]
file[color=blue][color=green]
> > and[color=darkred]
> > > then having the user select this file and transmitting it up to the[/color][/color][/color]
other[color=blue][color=green][color=darkred]
> > > site. What other options do I have instead of creating the file first[/color][/color][/color]
or[color=blue][color=green]
> > is[color=darkred]
> > > it possible to tell the input type='file' exactly what the file is and[/color]
> > where[color=darkred]
> > > it is?
> > >
> > > Thanks
> > >
> > > Eric
> > >
> > > "Jeffrey Palermo [MCP]" wrote:
> > >
> > > > You would do this exactly the same as you would do it in regular[/color][/color][/color]
HTML[color=blue][color=green][color=darkred]
> > > > without ASP.NET. In fact, you don't have to use server controls for[/color]
> > this.[color=darkred]
> > > > You can use a normal form and normal <input type="file"/>, <input
> > > > type="submit"/> controls, and set the action of the form to the[/color][/color][/color]
other[color=blue][color=green]
> > page.[color=darkred]
> > > > Don't use a runat="server" form. A regular form will do. Then in[/color][/color][/color]
the[color=blue][color=green]
> > page[color=darkred]
> > > > you post to, just retrieve the form values.
> > > >
> > > > Best regards,
> > > > Jeffrey Palermo
> > > >
> > > > "eswanson" <eswanson@discussions.microsoft.com> wrote in message
> > > > news:CDA3312F-AA93-4821-835C-C07E2503C2E2@microsoft.com...
> > > > > I have a web page I need to post a file plus some other fields to[/color][/color][/color]
it.[color=blue][color=green]
> > How[color=darkred]
> > > > > can I do this from a asp.net page. I know I can send individual[/color][/color][/color]
fields[color=blue][color=green]
> > to[color=darkred]
> > > > the
> > > > > other page, but how do I send a file to the other page, or is[/color][/color][/color]
there[color=blue][color=green][color=darkred]
> > > > something
> > > > > else like a stream which will be like a file. I am attempting to[/color][/color][/color]
get[color=blue][color=green]
> > a[color=darkred]
> > > > way
> > > > > from writing out a file and then having to give the page that I am[/color]
> > posting[color=darkred]
> > > > to
> > > > > the file name. Instead I would like to just from asp.net post to[/color][/color][/color]
the[color=blue][color=green][color=darkred]
> > > > other
> > > > > HTML page, the information, plus this file without writing a file[/color][/color][/color]
out[color=blue][color=green][color=darkred]
> > > > first.
> > > >
> > > >
> > > >[/color]
> >
> >
> >[/color][/color]


ejs
Guest
 
Posts: n/a
#8: Nov 18 '05

re: asp.net form to send a request to a put request


Jeff,

Thanks for the suggestions, but I really do not want to prompt the user for
a file and also, I really do not want to write a file out . Instead I would
like to store the contents of the file on a aspx page and then press a button
on that page and send this information to the page that wants a file and
other inputs....

I know that a 3rd party control wilsoncontrols will allow you to post data
on this page to other pages. What I need assistance on is how what format
does the paramater for the input=file needs to be? I do not want to write a
file first, instead I want to store this information into a text box on the
form.

Hope this makes since.

Thanks

Eric

"Jeffrey Palermo [MCP]" wrote:
[color=blue]
> Eric,
> Another, easier but less flexible way to do it is to use the WebClient
> class:
>
> Console.Write("\nPlease enter the URI to post data to : ");
>
> String uriString = "http://localhost/WebApplication1/AcceptFile.aspx";
>
> // Create a new WebClient instance.
>
> WebClient myWebClient = new WebClient();
>
> Console.WriteLine("\nPlease enter the fully qualified path of the file to be
> uploaded to the URI");
>
> string fileName = @"c:\upload.txt";
>
> Console.WriteLine("Uploading {0} to {1} ...",fileName,uriString);
>
> byte[] responseArray = myWebClient.UploadFile(uriString, "POST", fileName);
>
>
> // Decode and display the response.
>
> Console.WriteLine("\nResponse Received.The contents of the file uploaded
> are: \n{0}",Encoding.ASCII.GetString(responseArray));
>
> Console.ReadLine();
>
>
>
> Best regards,
>
> Jeffrey Palermo
>
> "eswanson" <eswanson@discussions.microsoft.com> wrote in message
> news:64B80D54-6848-467F-A296-9C763D24EE02@microsoft.com...[color=green]
> > Please read the entire reponse, hopefully this clears up your questions.
> >
> > The data used that needs to go into the batchupload page comes from a
> > server. My problem is that currently I write a file to the server and[/color]
> then[color=green]
> > the user has to pick this file and send it up to the batchupload page.[/color]
> The[color=green]
> > batchupload page is not one of our page, instead it is another company's
> > page. This is there interface to do batch processing. We have no control
> > over it. We just call this page "batchupload" with a file and other
> > parameters. I am attempting to call the page "batchupload" and send fill[/color]
> in[color=green]
> > the parameters with out first creating the file. Is this possible? Do[/color]
> you[color=green]
> > understand our problem.
> >
> > First batchupload is a page from another company. It is used for their
> > batch processing. Request parameters include a file <html input[/color]
> type=file> -[color=green]
> > does this have to be a file or some other data stream stored on the page[/color]
> and[color=green]
> > then sent over to this page?
> >
> > The html page I sent you would be a page that was written for us to
> > communicate with the batchupload page. I can hard code all of the other
> > parameters except for the input type=file. Instead of writing out a file,[/color]
> I[color=green]
> > would like to buffer the file data into an asp.net page and then just send
> > all of the information at once over to the "batchupload" page.
> >
> > I know that I can use
> >[/color]
> httpppost(http://www.othercompany.com/batchupload?batchid='123'&programnumbe
> r='ABC'&xml=?????????)[color=green]
> > How do I specify the xml, since this variable is a file. What has to be[/color]
> in[color=green]
> > the data stream of xml, so that it appears to be a file, but is actually a
> > character string?
> >
> > Hopefully this clears up the confusion.
> >
> > Thanks
> >
> > Eric
> >
> > "Jeffrey Palermo [MCP]" wrote:
> >[color=darkred]
> > > Eric,
> > > I'm not sure I know exactly what you are trying to do, but if the[/color][/color]
> file[color=green][color=darkred]
> > > is coming from a user's machine, you can't automatically grab it. That
> > > would be a security issue. If the file is originating on the server,[/color][/color]
> then[color=green][color=darkred]
> > > there is no need for one page to grab it and post it to another page.[/color][/color]
> The[color=green][color=darkred]
> > > second page could just use the absolute path on the server or the[/color][/color]
> network to[color=green][color=darkred]
> > > open the file.
> > >
> > > Try reposting this question to the newsgroup, be more specific.
> > >
> > > Best regards,
> > > Jeffrey Palermo
> > >
> > > "eswanson" <eswanson@discussions.microsoft.com> wrote in message
> > > news:14C47C45-5C8A-450D-BAFE-2A8141E850B8@microsoft.com...
> > > > Hi Jeff,
> > > >
> > > > Here is an example that does this in HTML, but I would like to do this[/color][/color]
> in[color=green][color=darkred]
> > > > asp.net, but I do not want to create the file first, instead I would[/color][/color]
> like[color=green][color=darkred]
> > > to
> > > > somehow stream the data to this post instead of writing out the file[/color][/color]
> first[color=green][color=darkred]
> > > > and then having the user select the file and transfering it up to the[/color][/color]
> host[color=green][color=darkred]
> > > > site. Is this possible?
> > > >
> > > > Here is the current html:
> > > >
> > > > <form method="post" enctype="multipart/form-data"
> > > >[/color][/color]
> action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload"/>[color=green][color=darkred]
> > > > <!--<form method="post" enctype="multipart/form-data"
> > > >[/color][/color]
> action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload">-->[color=green][color=darkred]
> > > > XML: <input type="file" name="xml" id="xml="><br>
> > > > Batch ID: <input type="text" name="batchid" id="batchid="><br>
> > > > Program Number: <input type="text" name="programnumber"
> > > > id="programnumber="><br>
> > > > <input type="submit">
> > > >
> > > > I am attempting to automated the input type="file", instead I would[/color][/color]
> like[color=green][color=darkred]
> > > to
> > > > stream the file data from an asp.net page without first creating a[/color][/color]
> file[color=green][color=darkred]
> > > and
> > > > then having the user select this file and transmitting it up to the[/color][/color]
> other[color=green][color=darkred]
> > > > site. What other options do I have instead of creating the file first[/color][/color]
> or[color=green][color=darkred]
> > > is
> > > > it possible to tell the input type='file' exactly what the file is and
> > > where
> > > > it is?
> > > >
> > > > Thanks
> > > >
> > > > Eric
> > > >
> > > > "Jeffrey Palermo [MCP]" wrote:
> > > >
> > > > > You would do this exactly the same as you would do it in regular[/color][/color]
> HTML[color=green][color=darkred]
> > > > > without ASP.NET. In fact, you don't have to use server controls for
> > > this.
> > > > > You can use a normal form and normal <input type="file"/>, <input
> > > > > type="submit"/> controls, and set the action of the form to the[/color][/color]
> other[color=green][color=darkred]
> > > page.
> > > > > Don't use a runat="server" form. A regular form will do. Then in[/color][/color]
> the[color=green][color=darkred]
> > > page
> > > > > you post to, just retrieve the form values.
> > > > >
> > > > > Best regards,
> > > > > Jeffrey Palermo
> > > > >
> > > > > "eswanson" <eswanson@discussions.microsoft.com> wrote in message
> > > > > news:CDA3312F-AA93-4821-835C-C07E2503C2E2@microsoft.com...
> > > > > > I have a web page I need to post a file plus some other fields to[/color][/color]
> it.[color=green][color=darkred]
> > > How
> > > > > > can I do this from a asp.net page. I know I can send individual[/color][/color]
> fields[color=green][color=darkred]
> > > to
> > > > > the
> > > > > > other page, but how do I send a file to the other page, or is[/color][/color]
> there[color=green][color=darkred]
> > > > > something
> > > > > > else like a stream which will be like a file. I am attempting to[/color][/color]
> get[color=green][color=darkred]
> > > a
> > > > > way
> > > > > > from writing out a file and then having to give the page that I am
> > > posting
> > > > > to
> > > > > > the file name. Instead I would like to just from asp.net post to[/color][/color]
> the[color=green][color=darkred]
> > > > > other
> > > > > > HTML page, the information, plus this file without writing a file[/color][/color]
> out[color=green][color=darkred]
> > > > > first.
> > > > >
> > > > >
> > > > >
> > >
> > >
> > >[/color][/color]
>
>
>[/color]
Jeffrey Palermo [MCP]
Guest
 
Posts: n/a
#9: Nov 18 '05

re: asp.net form to send a request to a put request


Good luck.


"ejs" <ejs@discussions.microsoft.com> wrote in message
news:AAE4AC39-BFB1-46D9-BCBA-BF5F2146AEF8@microsoft.com...[color=blue]
> Jeff,
>
> Thanks for the suggestions, but I really do not want to prompt the user[/color]
for[color=blue]
> a file and also, I really do not want to write a file out . Instead I[/color]
would[color=blue]
> like to store the contents of the file on a aspx page and then press a[/color]
button[color=blue]
> on that page and send this information to the page that wants a file and
> other inputs....
>
> I know that a 3rd party control wilsoncontrols will allow you to post data
> on this page to other pages. What I need assistance on is how what format
> does the paramater for the input=file needs to be? I do not want to write[/color]
a[color=blue]
> file first, instead I want to store this information into a text box on[/color]
the[color=blue]
> form.
>
> Hope this makes since.
>
> Thanks
>
> Eric
>
> "Jeffrey Palermo [MCP]" wrote:
>[color=green]
> > Eric,
> > Another, easier but less flexible way to do it is to use the WebClient
> > class:
> >
> > Console.Write("\nPlease enter the URI to post data to : ");
> >
> > String uriString = "http://localhost/WebApplication1/AcceptFile.aspx";
> >
> > // Create a new WebClient instance.
> >
> > WebClient myWebClient = new WebClient();
> >
> > Console.WriteLine("\nPlease enter the fully qualified path of the file[/color][/color]
to be[color=blue][color=green]
> > uploaded to the URI");
> >
> > string fileName = @"c:\upload.txt";
> >
> > Console.WriteLine("Uploading {0} to {1} ...",fileName,uriString);
> >
> > byte[] responseArray = myWebClient.UploadFile(uriString, "POST",[/color][/color]
fileName);[color=blue][color=green]
> >
> >
> > // Decode and display the response.
> >
> > Console.WriteLine("\nResponse Received.The contents of the file uploaded
> > are: \n{0}",Encoding.ASCII.GetString(responseArray));
> >
> > Console.ReadLine();
> >
> >
> >
> > Best regards,
> >
> > Jeffrey Palermo
> >
> > "eswanson" <eswanson@discussions.microsoft.com> wrote in message
> > news:64B80D54-6848-467F-A296-9C763D24EE02@microsoft.com...[color=darkred]
> > > Please read the entire reponse, hopefully this clears up your[/color][/color][/color]
questions.[color=blue][color=green][color=darkred]
> > >
> > > The data used that needs to go into the batchupload page comes from a
> > > server. My problem is that currently I write a file to the server and[/color]
> > then[color=darkred]
> > > the user has to pick this file and send it up to the batchupload page.[/color]
> > The[color=darkred]
> > > batchupload page is not one of our page, instead it is another[/color][/color][/color]
company's[color=blue][color=green][color=darkred]
> > > page. This is there interface to do batch processing. We have no[/color][/color][/color]
control[color=blue][color=green][color=darkred]
> > > over it. We just call this page "batchupload" with a file and other
> > > parameters. I am attempting to call the page "batchupload" and send[/color][/color][/color]
fill[color=blue][color=green]
> > in[color=darkred]
> > > the parameters with out first creating the file. Is this possible?[/color][/color][/color]
Do[color=blue][color=green]
> > you[color=darkred]
> > > understand our problem.
> > >
> > > First batchupload is a page from another company. It is used for[/color][/color][/color]
their[color=blue][color=green][color=darkred]
> > > batch processing. Request parameters include a file <html input[/color]
> > type=file> -[color=darkred]
> > > does this have to be a file or some other data stream stored on the[/color][/color][/color]
page[color=blue][color=green]
> > and[color=darkred]
> > > then sent over to this page?
> > >
> > > The html page I sent you would be a page that was written for us to
> > > communicate with the batchupload page. I can hard code all of the[/color][/color][/color]
other[color=blue][color=green][color=darkred]
> > > parameters except for the input type=file. Instead of writing out a[/color][/color][/color]
file,[color=blue][color=green]
> > I[color=darkred]
> > > would like to buffer the file data into an asp.net page and then just[/color][/color][/color]
send[color=blue][color=green][color=darkred]
> > > all of the information at once over to the "batchupload" page.
> > >
> > > I know that I can use
> > >[/color]
> >[/color][/color]
httpppost(http://www.othercompany.com/batchupload?batchid='123'&programnumbe[color=blue][color=green]
> > r='ABC'&xml=?????????)[color=darkred]
> > > How do I specify the xml, since this variable is a file. What has to[/color][/color][/color]
be[color=blue][color=green]
> > in[color=darkred]
> > > the data stream of xml, so that it appears to be a file, but is[/color][/color][/color]
actually a[color=blue][color=green][color=darkred]
> > > character string?
> > >
> > > Hopefully this clears up the confusion.
> > >
> > > Thanks
> > >
> > > Eric
> > >
> > > "Jeffrey Palermo [MCP]" wrote:
> > >
> > > > Eric,
> > > > I'm not sure I know exactly what you are trying to do, but if[/color][/color][/color]
the[color=blue][color=green]
> > file[color=darkred]
> > > > is coming from a user's machine, you can't automatically grab it.[/color][/color][/color]
That[color=blue][color=green][color=darkred]
> > > > would be a security issue. If the file is originating on the[/color][/color][/color]
server,[color=blue][color=green]
> > then[color=darkred]
> > > > there is no need for one page to grab it and post it to another[/color][/color][/color]
page.[color=blue][color=green]
> > The[color=darkred]
> > > > second page could just use the absolute path on the server or the[/color]
> > network to[color=darkred]
> > > > open the file.
> > > >
> > > > Try reposting this question to the newsgroup, be more specific.
> > > >
> > > > Best regards,
> > > > Jeffrey Palermo
> > > >
> > > > "eswanson" <eswanson@discussions.microsoft.com> wrote in message
> > > > news:14C47C45-5C8A-450D-BAFE-2A8141E850B8@microsoft.com...
> > > > > Hi Jeff,
> > > > >
> > > > > Here is an example that does this in HTML, but I would like to do[/color][/color][/color]
this[color=blue][color=green]
> > in[color=darkred]
> > > > > asp.net, but I do not want to create the file first, instead I[/color][/color][/color]
would[color=blue][color=green]
> > like[color=darkred]
> > > > to
> > > > > somehow stream the data to this post instead of writing out the[/color][/color][/color]
file[color=blue][color=green]
> > first[color=darkred]
> > > > > and then having the user select the file and transfering it up to[/color][/color][/color]
the[color=blue][color=green]
> > host[color=darkred]
> > > > > site. Is this possible?
> > > > >
> > > > > Here is the current html:
> > > > >
> > > > > <form method="post" enctype="multipart/form-data"
> > > > >[/color]
> > action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload"/>[color=darkred]
> > > > > <!--<form method="post" enctype="multipart/form-data"
> > > > >[/color]
> >[/color][/color]
action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload">-->[color=blue][color=green][color=darkred]
> > > > > XML: <input type="file" name="xml" id="xml="><br>
> > > > > Batch ID: <input type="text" name="batchid" id="batchid="><br>
> > > > > Program Number: <input type="text" name="programnumber"
> > > > > id="programnumber="><br>
> > > > > <input type="submit">
> > > > >
> > > > > I am attempting to automated the input type="file", instead I[/color][/color][/color]
would[color=blue][color=green]
> > like[color=darkred]
> > > > to
> > > > > stream the file data from an asp.net page without first creating a[/color]
> > file[color=darkred]
> > > > and
> > > > > then having the user select this file and transmitting it up to[/color][/color][/color]
the[color=blue][color=green]
> > other[color=darkred]
> > > > > site. What other options do I have instead of creating the file[/color][/color][/color]
first[color=blue][color=green]
> > or[color=darkred]
> > > > is
> > > > > it possible to tell the input type='file' exactly what the file is[/color][/color][/color]
and[color=blue][color=green][color=darkred]
> > > > where
> > > > > it is?
> > > > >
> > > > > Thanks
> > > > >
> > > > > Eric
> > > > >
> > > > > "Jeffrey Palermo [MCP]" wrote:
> > > > >
> > > > > > You would do this exactly the same as you would do it in regular[/color]
> > HTML[color=darkred]
> > > > > > without ASP.NET. In fact, you don't have to use server controls[/color][/color][/color]
for[color=blue][color=green][color=darkred]
> > > > this.
> > > > > > You can use a normal form and normal <input type="file"/>,[/color][/color][/color]
<input[color=blue][color=green][color=darkred]
> > > > > > type="submit"/> controls, and set the action of the form to the[/color]
> > other[color=darkred]
> > > > page.
> > > > > > Don't use a runat="server" form. A regular form will do. Then[/color][/color][/color]
in[color=blue][color=green]
> > the[color=darkred]
> > > > page
> > > > > > you post to, just retrieve the form values.
> > > > > >
> > > > > > Best regards,
> > > > > > Jeffrey Palermo
> > > > > >
> > > > > > "eswanson" <eswanson@discussions.microsoft.com> wrote in message
> > > > > > news:CDA3312F-AA93-4821-835C-C07E2503C2E2@microsoft.com...
> > > > > > > I have a web page I need to post a file plus some other fields[/color][/color][/color]
to[color=blue][color=green]
> > it.[color=darkred]
> > > > How
> > > > > > > can I do this from a asp.net page. I know I can send[/color][/color][/color]
individual[color=blue][color=green]
> > fields[color=darkred]
> > > > to
> > > > > > the
> > > > > > > other page, but how do I send a file to the other page, or is[/color]
> > there[color=darkred]
> > > > > > something
> > > > > > > else like a stream which will be like a file. I am attempting[/color][/color][/color]
to[color=blue][color=green]
> > get[color=darkred]
> > > > a
> > > > > > way
> > > > > > > from writing out a file and then having to give the page that[/color][/color][/color]
I am[color=blue][color=green][color=darkred]
> > > > posting
> > > > > > to
> > > > > > > the file name. Instead I would like to just from asp.net post[/color][/color][/color]
to[color=blue][color=green]
> > the[color=darkred]
> > > > > > other
> > > > > > > HTML page, the information, plus this file without writing a[/color][/color][/color]
file[color=blue][color=green]
> > out[color=darkred]
> > > > > > first.
> > > > > >
> > > > > >
> > > > > >
> > > >
> > > >
> > > >[/color]
> >
> >
> >[/color][/color]


ejs
Guest
 
Posts: n/a
#10: Nov 18 '05

re: asp.net form to send a request to a put request


Jeff,

Is this possible to store the data in a text box and then somehow with the
right format send it to a page that accepts a get? The question is what
should the format of the text in the text box be?

Thanks

Eric

"Jeffrey Palermo [MCP]" wrote:
[color=blue]
> Good luck.
>
>
> "ejs" <ejs@discussions.microsoft.com> wrote in message
> news:AAE4AC39-BFB1-46D9-BCBA-BF5F2146AEF8@microsoft.com...[color=green]
> > Jeff,
> >
> > Thanks for the suggestions, but I really do not want to prompt the user[/color]
> for[color=green]
> > a file and also, I really do not want to write a file out . Instead I[/color]
> would[color=green]
> > like to store the contents of the file on a aspx page and then press a[/color]
> button[color=green]
> > on that page and send this information to the page that wants a file and
> > other inputs....
> >
> > I know that a 3rd party control wilsoncontrols will allow you to post data
> > on this page to other pages. What I need assistance on is how what format
> > does the paramater for the input=file needs to be? I do not want to write[/color]
> a[color=green]
> > file first, instead I want to store this information into a text box on[/color]
> the[color=green]
> > form.
> >
> > Hope this makes since.
> >
> > Thanks
> >
> > Eric
> >
> > "Jeffrey Palermo [MCP]" wrote:
> >[color=darkred]
> > > Eric,
> > > Another, easier but less flexible way to do it is to use the WebClient
> > > class:
> > >
> > > Console.Write("\nPlease enter the URI to post data to : ");
> > >
> > > String uriString = "http://localhost/WebApplication1/AcceptFile.aspx";
> > >
> > > // Create a new WebClient instance.
> > >
> > > WebClient myWebClient = new WebClient();
> > >
> > > Console.WriteLine("\nPlease enter the fully qualified path of the file[/color][/color]
> to be[color=green][color=darkred]
> > > uploaded to the URI");
> > >
> > > string fileName = @"c:\upload.txt";
> > >
> > > Console.WriteLine("Uploading {0} to {1} ...",fileName,uriString);
> > >
> > > byte[] responseArray = myWebClient.UploadFile(uriString, "POST",[/color][/color]
> fileName);[color=green][color=darkred]
> > >
> > >
> > > // Decode and display the response.
> > >
> > > Console.WriteLine("\nResponse Received.The contents of the file uploaded
> > > are: \n{0}",Encoding.ASCII.GetString(responseArray));
> > >
> > > Console.ReadLine();
> > >
> > >
> > >
> > > Best regards,
> > >
> > > Jeffrey Palermo
> > >
> > > "eswanson" <eswanson@discussions.microsoft.com> wrote in message
> > > news:64B80D54-6848-467F-A296-9C763D24EE02@microsoft.com...
> > > > Please read the entire reponse, hopefully this clears up your[/color][/color]
> questions.[color=green][color=darkred]
> > > >
> > > > The data used that needs to go into the batchupload page comes from a
> > > > server. My problem is that currently I write a file to the server and
> > > then
> > > > the user has to pick this file and send it up to the batchupload page.
> > > The
> > > > batchupload page is not one of our page, instead it is another[/color][/color]
> company's[color=green][color=darkred]
> > > > page. This is there interface to do batch processing. We have no[/color][/color]
> control[color=green][color=darkred]
> > > > over it. We just call this page "batchupload" with a file and other
> > > > parameters. I am attempting to call the page "batchupload" and send[/color][/color]
> fill[color=green][color=darkred]
> > > in
> > > > the parameters with out first creating the file. Is this possible?[/color][/color]
> Do[color=green][color=darkred]
> > > you
> > > > understand our problem.
> > > >
> > > > First batchupload is a page from another company. It is used for[/color][/color]
> their[color=green][color=darkred]
> > > > batch processing. Request parameters include a file <html input
> > > type=file> -
> > > > does this have to be a file or some other data stream stored on the[/color][/color]
> page[color=green][color=darkred]
> > > and
> > > > then sent over to this page?
> > > >
> > > > The html page I sent you would be a page that was written for us to
> > > > communicate with the batchupload page. I can hard code all of the[/color][/color]
> other[color=green][color=darkred]
> > > > parameters except for the input type=file. Instead of writing out a[/color][/color]
> file,[color=green][color=darkred]
> > > I
> > > > would like to buffer the file data into an asp.net page and then just[/color][/color]
> send[color=green][color=darkred]
> > > > all of the information at once over to the "batchupload" page.
> > > >
> > > > I know that I can use
> > > >
> > >[/color][/color]
> httpppost(http://www.othercompany.com/batchupload?batchid='123'&programnumbe[color=green][color=darkred]
> > > r='ABC'&xml=?????????)
> > > > How do I specify the xml, since this variable is a file. What has to[/color][/color]
> be[color=green][color=darkred]
> > > in
> > > > the data stream of xml, so that it appears to be a file, but is[/color][/color]
> actually a[color=green][color=darkred]
> > > > character string?
> > > >
> > > > Hopefully this clears up the confusion.
> > > >
> > > > Thanks
> > > >
> > > > Eric
> > > >
> > > > "Jeffrey Palermo [MCP]" wrote:
> > > >
> > > > > Eric,
> > > > > I'm not sure I know exactly what you are trying to do, but if[/color][/color]
> the[color=green][color=darkred]
> > > file
> > > > > is coming from a user's machine, you can't automatically grab it.[/color][/color]
> That[color=green][color=darkred]
> > > > > would be a security issue. If the file is originating on the[/color][/color]
> server,[color=green][color=darkred]
> > > then
> > > > > there is no need for one page to grab it and post it to another[/color][/color]
> page.[color=green][color=darkred]
> > > The
> > > > > second page could just use the absolute path on the server or the
> > > network to
> > > > > open the file.
> > > > >
> > > > > Try reposting this question to the newsgroup, be more specific.
> > > > >
> > > > > Best regards,
> > > > > Jeffrey Palermo
> > > > >
> > > > > "eswanson" <eswanson@discussions.microsoft.com> wrote in message
> > > > > news:14C47C45-5C8A-450D-BAFE-2A8141E850B8@microsoft.com...
> > > > > > Hi Jeff,
> > > > > >
> > > > > > Here is an example that does this in HTML, but I would like to do[/color][/color]
> this[color=green][color=darkred]
> > > in
> > > > > > asp.net, but I do not want to create the file first, instead I[/color][/color]
> would[color=green][color=darkred]
> > > like
> > > > > to
> > > > > > somehow stream the data to this post instead of writing out the[/color][/color]
> file[color=green][color=darkred]
> > > first
> > > > > > and then having the user select the file and transfering it up to[/color][/color]
> the[color=green][color=darkred]
> > > host
> > > > > > site. Is this possible?
> > > > > >
> > > > > > Here is the current html:
> > > > > >
> > > > > > <form method="post" enctype="multipart/form-data"
> > > > > >
> > > action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload"/>
> > > > > > <!--<form method="post" enctype="multipart/form-data"
> > > > > >
> > >[/color][/color]
> action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload">-->[color=green][color=darkred]
> > > > > > XML: <input type="file" name="xml" id="xml="><br>
> > > > > > Batch ID: <input type="text" name="batchid" id="batchid="><br>
> > > > > > Program Number: <input type="text" name="programnumber"
> > > > > > id="programnumber="><br>
> > > > > > <input type="submit">
> > > > > >
> > > > > > I am attempting to automated the input type="file", instead I[/color][/color]
> would[color=green][color=darkred]
> > > like
> > > > > to
> > > > > > stream the file data from an asp.net page without first creating a
> > > file
> > > > > and
> > > > > > then having the user select this file and transmitting it up to[/color][/color]
> the[color=green][color=darkred]
> > > other
> > > > > > site. What other options do I have instead of creating the file[/color][/color]
> first[color=green][color=darkred]
> > > or
> > > > > is
> > > > > > it possible to tell the input type='file' exactly what the file is[/color][/color]
> and[color=green][color=darkred]
> > > > > where
> > > > > > it is?
> > > > > >
> > > > > > Thanks
> > > > > >
> > > > > > Eric
> > > > > >
> > > > > > "Jeffrey Palermo [MCP]" wrote:
> > > > > >
> > > > > > > You would do this exactly the same as you would do it in regular
> > > HTML
> > > > > > > without ASP.NET. In fact, you don't have to use server controls[/color][/color]
> for[color=green][color=darkred]
> > > > > this.
> > > > > > > You can use a normal form and normal <input type="file"/>,[/color][/color]
> <input[color=green][color=darkred]
> > > > > > > type="submit"/> controls, and set the action of the form to the
> > > other
> > > > > page.
> > > > > > > Don't use a runat="server" form. A regular form will do. Then[/color][/color]
> in[color=green][color=darkred]
> > > the
> > > > > page
> > > > > > > you post to, just retrieve the form values.
> > > > > > >
> > > > > > > Best regards,
> > > > > > > Jeffrey Palermo
> > > > > > >
> > > > > > > "eswanson" <eswanson@discussions.microsoft.com> wrote in message
> > > > > > > news:CDA3312F-AA93-4821-835C-C07E2503C2E2@microsoft.com...
> > > > > > > > I have a web page I need to post a file plus some other fields[/color][/color]
> to[color=green][color=darkred]
> > > it.
> > > > > How
> > > > > > > > can I do this from a asp.net page. I know I can send[/color][/color]
> individual[color=green][color=darkred]
> > > fields
> > > > > to
> > > > > > > the
> > > > > > > > other page, but how do I send a file to the other page, or is
> > > there
> > > > > > > something
> > > > > > > > else like a stream which will be like a file. I am attempting[/color][/color]
> to[color=green][color=darkred]
> > > get
> > > > > a
> > > > > > > way
> > > > > > > > from writing out a file and then having to give the page that[/color][/color]
> I am[color=green][color=darkred]
> > > > > posting
> > > > > > > to
> > > > > > > > the file name. Instead I would like to just from asp.net post[/color][/color]
> to[color=green][color=darkred]
> > > the
> > > > > > > other
> > > > > > > > HTML page, the information, plus this file without writing a[/color][/color]
> file[color=green][color=darkred]
> > > out
> > > > > > > first.
> > > > > > >
> > > > > > >
> > > > > > >
> > > > >
> > > > >
> > > > >
> > >
> > >
> > >[/color][/color]
>
>
>[/color]
Closed Thread