472,352 Members | 1,670 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Need help with saving a local file through a web service to my server

I have created a web service that will be running on one of our servers. It
has a function in it called UploadFile. The way we would like to use it is
the user types in the url
http://MyWebSite/Upload.aspx?FileName=C:\Test\Test.txt. When the user gets
to this page, the code behind it will hit my web service and copy the file
specified in Request.QueryString("FileName") to our server. It works great
on my local development box but when I move it to the server, I keep getting
Could not find a part of the path "C:\Test\Test.txt".

What I imagine is happening is that it is looking for C:\Test\Test.txt on my
server now that I have moved it over. How do I specify a local file and send
it to the web service on my server and get it to upload. Below is the code
that I am using in the web service. Thanks for any help on this!

<WebMethod(Description:="Upload a single file through a web page passing a
parameter called 'FileName'.")> _

Public Function UploadFile(ByVal fs() As Byte, ByVal FlName As String) As
String

Try

Dim m As New MemoryStream(fs)

Dim FileExtension As String = FlName.Substring(FlName.Length - 3, 3)

Select Case FileExtension

Case "txt", "xml"

Dim f As New FileStream("\\myserver\" & FlName, FileMode.Create)

m.WriteTo(f)

m.Close()

f.Close()

f = Nothing

m = Nothing

Return "Success"

Case Else

Return "Failure"

End Select

Catch ex As Exception

Return ex.Message

End Try

End Function
Nov 21 '05 #1
0 1425

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

Similar topics

1
by: D. Shane Fowlkes | last post by:
The title sounds odd but let me explain....I have a custom DLL created with VB6 which is installed on the server and running just fine. One of the...
5
by: azgoddess1 | last post by:
During the installation I get these error messages: ***** SQL1390C The environment variable DB2Instance is not defined or is invalid An error...
3
by: Justnew | last post by:
Hei All Can some body help me here: I have a database name Customers, I a trying to connect to SQL server through vb.net using asp.net webform....
13
by: Siegfried Heintze | last post by:
I refered the engineer at my hosting service to http://support.microsoft.com/default.aspx?scid=kb;en-us;825738 where he tried to follow the...
22
by: EP | last post by:
When running my asp.net hosting service (asp.net without IIS), on server 2003 with IIS not installed, I get the following when trying to process a...
1
by: Phillip N Rounds | last post by:
I'm having problems using the WebClient.UploadFile() command. I have MySender.ASPX which is supposed to upload two files to the server. There is...
11
by: Kirk | last post by:
The following C# web service works fine until you uncomment the lines setting UserName and Password. Then the process starts as the specified...
1
by: ScriptProblem | last post by:
Hi Guys, I have a security concern with Mozilla and Netscape browsers(In IE it gives secuirity pop window) in Remote server(Client's server).When...
0
by: KNN | last post by:
I am running the frond end Access 2003 application under Citrix. There is no problem running the appcilation in this mode. When I try to export a...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

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.