Hello,
this is been frustrating me all morning. Any help would greatly be appreciated
I have a site (not my own, not done in asp.net) that will be posting data to
my c# page. There is an input type=file in that form. How do I get the value?
All the examples I see online tell you to set your form up as runat=server
but tha won't work in this case since I won't be dealing directly with the
form, just the returned data. This is what I have, it fails because it cant
convert a string to an HtmlInputFile... thoughts?
HtmlInputFile filMyFile = (HtmlInputFile)Request.QueryString["uplTheFile"];
// Convert to HttpPostedFile?
HttpPostedFile myFile = filMyFile.PostedFile;
int nFileLen = myFile.ContentLength;
byte[] myData = new byte[nFileLen];
string fileName = myFile.FileName;
string strBaseLocation = "c:\web\upload";
myFile.InputStream.Read(myData, 0, nFileLen);
FileStream newFile = new FileStream(strBaseLocation+fileName,
FileMode.Create);
newFile.Write(myData , 0, myData.Length);
newFile.Close(); 1 1703
Use Request.Files instead...
--
Patrice
"ashton" <as****@discussions.microsoft.com> a écrit dans le message de
news:58**********************************@microsof t.com... Hello,
this is been frustrating me all morning. Any help would greatly be
appreciated I have a site (not my own, not done in asp.net) that will be posting data
to my c# page. There is an input type=file in that form. How do I get the
value? All the examples I see online tell you to set your form up as runat=server but tha won't work in this case since I won't be dealing directly with the form, just the returned data. This is what I have, it fails because it
cant convert a string to an HtmlInputFile... thoughts?
HtmlInputFile filMyFile =
(HtmlInputFile)Request.QueryString["uplTheFile"]; // Convert to HttpPostedFile?
HttpPostedFile myFile = filMyFile.PostedFile; int nFileLen = myFile.ContentLength; byte[] myData = new byte[nFileLen]; string fileName = myFile.FileName; string strBaseLocation = "c:\web\upload"; myFile.InputStream.Read(myData, 0, nFileLen); FileStream newFile = new FileStream(strBaseLocation+fileName, FileMode.Create); newFile.Write(myData , 0, myData.Length); newFile.Close(); This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Don |
last post by:
Is there some way to populate the "Browse" box for a <input type=file...> with a default value? I
can do it for <input type=text...>, but can't seem to do it for <input type=file...>.
Any ideas?...
|
by: garbagecatcher |
last post by:
Hello,
here's my problem:
On my web server I generate a file, I need to send this
file to a different web server.
I have no control over the other web server.
The only way they accept...
|
by: Roberto |
last post by:
I have the following problem:
I have the following form client side:
<FORM.......>
<FORM action="./WZUpload.asp" method="Post" enctype="multipart/form-data"
WIDTH=100%>
<INPUT Type="file"...
|
by: Quick Function |
last post by:
For the <input type="file">, can I select directory? Multiple directories?
Thanks,
qq
|
by: Nathan |
last post by:
I have an aspx page with a data grid, some textboxes, and an update button.
This page also has one html input element with type=file (not inside the data
grid and runat=server).
The update...
|
by: ashton |
last post by:
Hello,
this is been frustrating me all morning. Any help would greatly be appreciated
I have a site (not my own, not done in asp.net) that will be posting data to
my c# page. There is an input...
|
by: ramkum |
last post by:
Hi,
I'm building a system where a presenter uploads a PPT to my server and
then I show it to all the participants. The problem is that most of the
media in the PPT is usually linked, so I'll...
|
by: ramkum |
last post by:
Hi,
I'm building a system where a presenter uploads a PPT to my server and
then I show it to all the participants. The problem is that most of the
media in the PPT is usually linked, so I'll...
|
by: SammyBar |
last post by:
Hi all,
I wonder is it possible to upload the content of an <imgfield to a server.
The content of the <imgwas downloaded from a web site different from the
one it should be uploaded. The image...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |