| Home | Forums | Reviews | Articles | Register |
![]() |
| Thread Tools |
Rating:
|
|
|
|
| |
|
Jeffrey Palermo [MCP]
Guest
Posts: n/a
|
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" <(E-Mail Removed)> wrote in message news:CDA3312F-AA93-4821-835C-(E-Mail Removed)... > 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. |
|
||
|
||||
|
|
|
| |
|
=?Utf-8?B?ZXN3YW5zb24=?=
Guest
Posts: n/a
|
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: > 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" <(E-Mail Removed)> wrote in message > news:CDA3312F-AA93-4821-835C-(E-Mail Removed)... > > 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
|
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" <(E-Mail Removed)> wrote in message news:14C47C45-5C8A-450D-BAFE-(E-Mail Removed)... > 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: > > > 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" <(E-Mail Removed)> wrote in message > > news:CDA3312F-AA93-4821-835C-(E-Mail Removed)... > > > 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. > > > > > > |
|
||
|
||||
|
=?Utf-8?B?ZXN3YW5zb24=?=
Guest
Posts: n/a
|
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: > 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" <(E-Mail Removed)> wrote in message > news:14C47C45-5C8A-450D-BAFE-(E-Mail Removed)... > > 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: > > > > > 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" <(E-Mail Removed)> wrote in message > > > news:CDA3312F-AA93-4821-835C-(E-Mail Removed)... > > > > 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
|
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" <(E-Mail Removed)> wrote in message news:64B80D54-6848-467F-A296-(E-Mail Removed)... > 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'&programnumbe r='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: > > > 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" <(E-Mail Removed)> wrote in message > > news:14C47C45-5C8A-450D-BAFE-(E-Mail Removed)... > > > 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: > > > > > > > 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" <(E-Mail Removed)> wrote in message > > > > news:CDA3312F-AA93-4821-835C-(E-Mail Removed)... > > > > > 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
|
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" <(E-Mail Removed)> wrote in message news:64B80D54-6848-467F-A296-(E-Mail Removed)... > 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'&programnumbe r='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: > > > 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" <(E-Mail Removed)> wrote in message > > news:14C47C45-5C8A-450D-BAFE-(E-Mail Removed)... > > > 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: > > > > > > > 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" <(E-Mail Removed)> wrote in message > > > > news:CDA3312F-AA93-4821-835C-(E-Mail Removed)... > > > > > 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. > > > > > > > > > > > > > > > > > > |
|
||
|
||||
|
=?Utf-8?B?ZWpz?=
Guest
Posts: n/a
|
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: > 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" <(E-Mail Removed)> wrote in message > news:64B80D54-6848-467F-A296-(E-Mail Removed)... > > 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'&programnumbe > r='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: > > > > > 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" <(E-Mail Removed)> wrote in message > > > news:14C47C45-5C8A-450D-BAFE-(E-Mail Removed)... > > > > 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: > > > > > > > > > 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" <(E-Mail Removed)> wrote in message > > > > > news:CDA3312F-AA93-4821-835C-(E-Mail Removed)... > > > > > > 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
|
Good luck.
"ejs" <(E-Mail Removed)> wrote in message news:AAE4AC39-BFB1-46D9-BCBA-(E-Mail Removed)... > 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: > > > 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" <(E-Mail Removed)> wrote in message > > news:64B80D54-6848-467F-A296-(E-Mail Removed)... > > > 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'&programnumbe > > r='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: > > > > > > > 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" <(E-Mail Removed)> wrote in message > > > > news:14C47C45-5C8A-450D-BAFE-(E-Mail Removed)... > > > > > 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: > > > > > > > > > > > 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" <(E-Mail Removed)> wrote in message > > > > > > news:CDA3312F-AA93-4821-835C-(E-Mail Removed)... > > > > > > > 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. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
|
||
|
||||
|
=?Utf-8?B?ZWpz?=
Guest
Posts: n/a
|
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: > Good luck. > > > "ejs" <(E-Mail Removed)> wrote in message > news:AAE4AC39-BFB1-46D9-BCBA-(E-Mail Removed)... > > 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: > > > > > 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" <(E-Mail Removed)> wrote in message > > > news:64B80D54-6848-467F-A296-(E-Mail Removed)... > > > > 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'&programnumbe > > > r='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: > > > > > > > > > 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" <(E-Mail Removed)> wrote in message > > > > > news:14C47C45-5C8A-450D-BAFE-(E-Mail Removed)... > > > > > > 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: > > > > > > > > > > > > > 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" <(E-Mail Removed)> wrote in message > > > > > > > news:CDA3312F-AA93-4821-835C-(E-Mail Removed)... > > > > > > > > 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. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
|
||
|
||||
|
|
|
| |
![]() |
| Thread Tools | |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Put "put user form" in spreadsheet | =?Utf-8?B?S2VpdGg=?= | Microsoft Excel New Users | 3 | 8th Apr 2007 07:00 PM |
| If you drag a meeting request or task request from your Inbox toCalendar or Tasks, the request is automatically accepted and an acceptancereply is sent to the senders. | 34345445 | Microsoft Access | 0 | 3rd Mar 2006 02:09 AM |
| Put the GD "send" button back how do you send the GD mail? | =?Utf-8?B?d2hhdCBldmVy?= | Microsoft Outlook | 1 | 10th Sep 2005 07:18 PM |
| Pre-Send Request Headers, Pre-Send Request Content | =?Utf-8?B?S2V2aW4gQnVydG9u?= | Microsoft ASP .NET | 0 | 31st Dec 2004 07:29 PM |
| Re: Accessing Request.InputStream / Request.BinaryRead *as the request is occuring*: How??? | Brian Birtle | Microsoft ASP .NET | 2 | 16th Oct 2003 03:11 PM |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc. |





