Client XML file upload to SQL 2000 via ASP

Client XML file upload to SQL 2000 via ASP

Post by lorraine barnar » Thu, 28 Jun 2001 19:54:20


I need to do the following in a web app

1. Allow user to select XML file they want to upload
2. Make this file (or its contents) accessible to server
side ASP as either a recorset or via DOM
3. Loop through each record and use a stored procedure to
validate its contents and populate a SQL table.

Is there a method to copy the XML file from client to
server or should I pass the XML string via a text area?  I
tried the later and was getting an error parsing the XML -
 "Invalid at top of document" I think

Please help!

Lorraine

 
 
 

Client XML file upload to SQL 2000 via ASP

Post by Bryant Like » Fri, 29 Jun 2001 06:06:03



Quote:> I need to do the following in a web app

> 1. Allow user to select XML file they want to upload
> 2. Make this file (or its contents) accessible to server
> side ASP as either a recorset or via DOM
> 3. Loop through each record and use a stored procedure to
> validate its contents and populate a SQL table.

> Is there a method to copy the XML file from client to
> server or should I pass the XML string via a text area?  I
> tried the later and was getting an error parsing the XML -
>  "Invalid at top of document" I think

The easiest way to achieve this would probably be to get the document on the
client side and then do a http post of the document to the server.

So to do this you are going to need to create some client side script that
will open the XML document the user specifies. It's been awhile since I've
done any serious client side scripting, but I'm pretty sure you will run
into some security issues on this. You may just have to instruct the user
that you are going to access his file and to click ok if any warning pop up.
Once you have loaded the XML into a DOM object, you can then use the XMLHTTP
object to post it to the server. Just specify the DOMDocument.xml as the
text to send.

Once it has been sent to the server you will need to use an ASP page to
accept the document. You can load it into another DOM object via the
DOMDocument.load function by passing it the Request object. From there you
can pass the xml to a stored procedure using ADO. The stored procedure can
then load the XML and parse it using OPENXML, and then insert it into the
database.

Of course this is all just a conceptual idea of how this could be done. If
you need more specific help post your specific questions.

--
Bryant

 
 
 

Client XML file upload to SQL 2000 via ASP

Post by TRaef » Fri, 29 Jun 2001 21:52:06


If you're uploading the file you need to use something like SA-FileUp or build
your own file upload code.

If you're using a text area, it should work as long as you have a valid XML doc
cut and pasted into the text area.

Can you provide sample code?

Let me know.

Thomas J. Raef
e-Based Solutions, Inc.

 
 
 

1. can't upload files from mac to sql 7 via web

hi

I use a mac and need to upload jpeg, gifs, and pdf's to a website running a
sql 7 database on nt 4.0.

The server administrator can't seem to fix my problem... I cant upload
anything via the website admin page!!!

I think the problem is that once a file is selected for upload, location
information is adding to the file name something like this...

"Quiet.jpg" becomes "/Macintosh HD/Desktop Folder/PC name folder/Quiet.jpg"

when this long file name tries to upload, there is an error message...

         uploadpage error '800a0005'
        Invalid procedure call or argument
        /erealbooks/store-admin/file_upload.asp, line 73

Does anyone know what the problem is?  Could it be SFM or an odbc issue?

Please help if you can,

Bill Pace
Miami, Fl.

2. help

3. Downloding \ Uploading files to SQL Server 2000

4. ODBC app in Dos

5. Uploading PDF Files Into SQL Server 2000

6. a good oracle FAQ

7. Asp.net treeview XML SQL Server 2000 problem

8. Database is Marked Inaccessible

9. ASP, SQL-SERVER 2000, XML?

10. Using microsoft.xmldom in ASP with XML from SQL Server 2000

11. Passing XML to SQL Server 2000 stored procedure through ASP

12. SQL 2000, XML, and ASP...Help Please!

13. SQL XML Stored Procedure using XML Explicit Returing XML to ASP Page