473,386 Members | 1,644 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Converting PostedFile to an XMLDocument.

I need to convert an HTTPPostedFile I am getting from the client to an
XMLDocument. The class I am using must have a document. The following
gives me an error when I try and build. I cannot change the converting
class.

Any help would be appreciated.

The error is:
Value of type 'System.Web.HttpPostedFile' cannot be converted to
'System.Xml.XmlDocument'

The code:
Select Case Extension

Case "xml"

ConvertXML.LoadCMRToTempTables(Session.SessionID,
SelectedFile.PostedFile) <<< error here.

Case ".B8"

ConvertB8.LoadB8IntoTempTables(Session.SessionID,
SelectedFile.PostedFile)

End Select


Nov 12 '05 #1
2 3650
Thomasa Gregg wrote:
I need to convert an HTTPPostedFile I am getting from the client to an
XMLDocument. The class I am using must have a document. The following
gives me an error when I try and build. I cannot change the converting
class.


You can't convert HTTPPostedFile to XmlDocument. Instead you can load
content of HTTPPostedFile to XmlDocument:

XmlDocument doc = new XmlDocument();
doc.Load(postedFile.InputStream);

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #2
Thomasa Gregg wrote:
I need to convert an HTTPPostedFile I am getting from the client to an
XMLDocument. The class I am using must have a document. The following
gives me an error when I try and build. I cannot change the converting
class.


You can't convert HTTPPostedFile to XmlDocument. Instead you can load
content of HTTPPostedFile to XmlDocument:

XmlDocument doc = new XmlDocument();
doc.Load(postedFile.InputStream);

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Thomasa Gregg | last post by:
I need to convert an HTTPPostedFile I am getting from the client to an XMLDocument. The class I am using must have a document. The following gives me an error when I try and build. I cannot...
1
by: Bostonasian | last post by:
I need to write a method that takes System.Xml.XmlDocument and Xsd Path to validate XmlDocument. How can I convert XmlDocument to XmlReader?
4
by: Patrick Olurotimi Ige | last post by:
Any help to conver the code below to VB.Net? Function getXML(ByVal sourceFile As String) Dim myRequest As System.Net.WebRequest = System.Net.WebRequest.Create(sourceFile) Dim myResponse As...
2
by: CVerma | last post by:
I'm using an html input control (System.web.UI.HTMLControls.HTMLInputFile) to upload files such as msword, excel, jpg, and pdf. I have the encType property set in the form:...
4
by: bwalke | last post by:
Help Needed Please!!! With a VB.NET web application, I am trying to save pictures and files to a directory on the web server. However, the web server is not grabbing the Posted Files. For...
2
by: vips | last post by:
I am using asp.net (VB) for uploading the files on my server I am using input type file (runat=server) my code is If ( FileProductImage.PostedFile.ContentLength > 0 ) Then strurl =...
6
by: Patrick.O.Ige | last post by:
Can someone help me convert the code below to VB.NET. Thanks Function getXML(ByVal sourceFile As String) Dim myRequest As System.Net.WebRequest = System.Net.WebRequest.Create(sourceFile) ...
1
by: Jgold7 | last post by:
Don't know if this is in the right group, but here goes: I am working with a website that I am selecting files to be uploaded on one page (ex. UploadAttachment.aspx) and I need to retrieve those...
2
by: ilyagzak | last post by:
Hi, I have a dataset that I am trying to convert to xmldocument. I get a message: "The path is too long after being fully qualified. Make sure path is less than 260 characters." My code is...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
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...
0
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...
0
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
0
BarryA
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.