Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

Recieve a file via HTTP POST to a webservice

 
 
Saddergoat
Guest
Posts: n/a
 
      09-05-2003
Hi,

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:

<html>
<body>
<h3> Upload Shape File </h3>
<hr />
<form name='uploadShape' method='POST'
action='http://localhost/TEClientAdmin/Service1.asmx/addSha
pe' >
Name: <input name='shapeName'
type='text' /> <br />
shp file: <input name='shp()'
type='file' /> <br />
<input type='submit'
value='Upload' />
</form>
</body>
</html>

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:\"
Try
'Dim memStream As New System.IO.MemoryStream
(shp)
'Dim fStream As New System.IO.FileStream
(shapeRoot & shapeName & ".shp",
System.IO.FileMode.Create.Create)

'memStream.WriteTo(fStream)
'memStream.Close()
'fStream.Close()

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

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

 
Reply With Quote
 
 
 
Reply

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 asis.morodo@drunpe.com 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



Advertisments