Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Recieve a file via HTTP POST to a webservice

Thread Tools

Recieve a file via HTTP POST to a webservice

Posts: n/a

I am trying to upload a file from a form via POST to a
webservice (VB.NET).

If I set enctype='multipart/form-data' on the form I get a
500 error.

If I don't the submission results in a error saying that
the file cannot be converted to type Byte.

Any suggestions would be most appreciated.

My html form code is:

<h3> Upload Shape File </h3>
<hr />
<form name='uploadShape' method='POST'
pe' >
Name: <input name='shapeName'
type='text' /> <br />
shp file: <input name='shp()'
type='file' /> <br />
<input type='submit'
value='Upload' />

My webmethod is:

<WebMethod()> Public Function addShape(ByVal shp() As
Byte, ByVal shapeName As String, ByVal authUser As String,
ByVal authPwd As String) As String
Dim shapeRoot As String = "c:\"
'Dim memStream As New System.IO.MemoryStream
'Dim fStream As New System.IO.FileStream
(shapeRoot & shapeName & ".shp",


'fStream = Nothing
'memStream = Nothing
Return "OK"

Catch e As Exception
Return e.Message
End Try
End Function

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
HTTP SOAP/HTTP GET/HTTP POST milan_9211 Software 0 01-10-2011 02:10 PM
recieve zip file via xml XML 6 12-27-2007 08:45 PM
WebService To WebService HTTP Connection Limit Scott ASP .Net Web Services 1 02-01-2006 10:25 PM
Recieve Post, New Session Won't Stick, Cookielss Jimmy Jazz ASP .Net Security 0 09-02-2005 09:58 AM
How to post data to a different domain and recieve a response Julia ASP General 7 10-22-2004 06:35 PM