473,403 Members | 2,323 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,403 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 1457

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 many functions within the COM Obj is that it will...
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 ocured while loading the command "C:\Program...
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. I want to connect to the server programatically...
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 directions there. He said there was no such file:...
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 request. "System.DllNotFoundException: Unable to...
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 also ConsumeFileUpload.aspx which is intended to...
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 user, but hangs in a suspended state. In fact, any...
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 I am trying to call an Asp.NET web service from...
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 report and select a drive on the citrix server, ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.