473,785 Members | 2,842 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to copy files from desktop to web server

I have a desktop application which communicates with a web server, using a
web service.

Mostly, the web service reads and writes data to Access databases on the web
server.

Now, I need to copy a large (1 MB to 30 MB) MDB file from the desktop to the
web server, replacing an existing file on the server.

What is the best way to do this from within a VB.Net windows program?

I've tried some solutions I found on the net which break the file up into
chunks, pass the chunks to the web service, and then it recombines the
chunks. But the final MDB file is a few bytes different than the original,
and crashes Access when I try to open it.

Can I use FTP or some other protocol without spending weeks programming a
custom solution?

Thanks for any suggestions!

---Selden
Nov 21 '05 #1
2 3302
Selden,

You can use the FTP protocol to upload your file. Use the Indy library
to easily connect to a FTP server and upload your files -
http://www.indyproject.org/

Regards,

Philip Hristov

Nov 21 '05 #2
Selden,

You can do an upload, you can as well take a little part of this sample I
once made, when you than even before it do a zip over the blob field, than
it can even be very efficient.

This is not the code, this is much more, however in my opinion is your
problem easily to extract from this.

\\\needs a picturebox and 4 buttons on a windowform
Private ds As New DataSet
Private abyt() As Byte
Private fo As New OpenFileDialog
Private sf As New SaveFileDialog
Private Sub Button1_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button1.Click
'Reading a picture from disk and put it in a bytearray
If fo.ShowDialog = DialogResult.OK Then
Dim fs As New IO.FileStream(f o.FileName, _
IO.FileMode.Ope n)
Dim br As New IO.BinaryReader (fs)
abyt = br.ReadBytes(CI nt(fs.Length))
br.Close()
'just to show the sample without a fileread error
Dim ms As New IO.MemoryStream (abyt)
Me.PictureBox1. Image = Image.FromStrea m(ms)
End If
End Sub
Private Sub Button2_Click(B yVal sender As System.Object, ByVal _
e As System.EventArg s) Handles Button2.Click
'writing a picture from a bytearray to disk
If sf.ShowDialog = DialogResult.OK Then
Dim fs As New IO.FileStream(s f.FileName, _
IO.FileMode.Cre ateNew)
Dim bw As New IO.BinaryWriter (fs)
bw.Write(abyt)
bw.Close()
End If
End Sub
Private Sub Button3_Click(B yVal sender As System.Object, ByVal _
e As System.EventArg s) Handles Button3.Click
'writing a bytearray to a webservice dataset
Dim ws As New localhost.DataB aseUpdate
ws.SetDataset(a byt)
End Sub
Private Sub Button4_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button4.Click
'reading a picture from a webservice dataset
Dim ws As New localhost.DataB aseUpdate
abyt = ws.GetByte
Dim ms As New IO.MemoryStream (abyt)
Me.PictureBox1. Image = Image.FromStrea m(ms)
End Sub
End Class
////
\\\\Webservice
<WebMethod()> _
Public Function GetByte() As Byte()
Dim ds As New DataSet
ds.ReadXml("C:\ wsblob.xml")
Return CType(ds.Tables (0).Rows(0)(0), Byte())
End Function
<WebMethod()> _
Public Sub SetDataset(ByVa l abyte As Byte())
Dim ds As New DataSet
ds.Tables.Add(N ew DataTable("Phot o"))
ds.Tables(0).Co lumns.Add(New DataColumn("Sam ple"))
ds.Tables(0).Co lumns(0).DataTy pe = GetType(System. Byte())
ds.Tables(0).Ro ws.Add(ds.Table s(0).NewRow)
ds.Tables(0).Ro ws(0)(0) = abyte
ds.WriteXml("C: \wsblob.xml", XmlWriteMode.Wr iteSchema)
End Sub
////

I hope this helps a little bit?

Cor
Nov 21 '05 #3

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

Similar topics

3
2191
by: Johnny | last post by:
Hi, I have created an ASP.NET application (let's call it FooBar) with VS.NET on my local machine, residing in http://localhost/FooBar. Deploying it to another folder on my machine works well with FrontPage Server Extensions, but I don't manage to deploy the application to my web provider http root folder. When I run Copy Project, I get an error message just saying 'Unable to create Web project 'myname'. Not found.'.
2
1986
by: Bahman | last post by:
Hello! Sending email attachments works only if the file is on the server file system. So, I need to copy the local file to the server. Is there an easy way of doing this? Thank you!
2
1647
by: Steve Franks | last post by:
The Copy Web tool provided with VS.NET 2005 is very convenient. However every once in a while it seems to think the files on the remote server have changed, which they have not. Then when I use the Copy Web Site feature of Copy Web to just copy the entire web site over, it thinks it has to re-upload the entire site which takes a very long time - when in fact those files on the remote have not changed. Does anyone know why this occurs...
4
7043
by: Jon Asher | last post by:
Hi, I'm trying to do a simple import of a comma delimited text file with COPY but it's returning an error. The file has been granted all permissions in Linux, so it's not clear to me what the problem is. Version 7.41 is installed... see below for details: A comma delimited text file has been placed in a local directory with permissions set to allow any user to read or write to it: /root/Desktop/server_transfer/WorldPoints_v2.txt'
3
4166
by: jason | last post by:
I've been playing around with new (for 2.0) membershp functionality. I was able to build a simple login form that secures a directory on a project I built locally on my development desktop. However, when I attempt to follow the same steps on the remote test server (a website I access via filesystem security accross my lan ).. I get the following when I attempt to select the security tab from the administer selection of the login...
0
2323
by: jhaek19 | last post by:
hi! do you have a code on how to copy files from local computer to remote computer? please help: when I run this code, it gives an error, File not Found or Path not Found... code: FileFrom = "C:\Documents and Settings\Administrator\Desktop\pic1.jpg", FileTo = "Server.Mappath("img\") fs.CopyFile FileFrom, FileTo
7
2301
by: elgiei | last post by:
Good morning at all, i have to implement a server,that every n-seconds (eg. 10sec) sends to other clients,which files and directory has been deleted or modified. i build a n-tree, for each files on harddisk there's a node into n- tree, this solution is not good for large hard disk.. and i can't use inotify (it's forbidden), and only c solutions are accepted without third party software or external calls.
25
2896
by: Andy_Khosravi | last post by:
I just recently changed my database that I'm running from a monolithic DB to a split FE/BE. The front end resides on the client machine and the BE resides on a network drive. I'm experimenting with a utility developed by Tony Toews to handle the distribution and subsequent updates of the software. I'm having some trouble with the overall upgrade process I've implemented, and I'm hoping one of you may have an idea how to go about fixing...
4
2730
by: Tom | last post by:
Every week our web guys publish the web site to all of our servers by logging into the server and doing a copy - paiste. We want to elminate the developers from logging into each server and doing this, so we want to create them a windows app that allows them to copy the web folder from their machine and publish it to each server. Is there a way to do this? We want to do the following: 1) be able to connect to the web servers without...
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10327
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10092
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8973
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7499
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3647
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.