Copying An Image from a folder to another using Web services

Asked By nikita kumar
06-Sep-10 12:57 AM
Earn up to 0 extra points for answering this tough question.
Hi,
I am new to Web Services.Can anybody help me how to copy an image file from a folder into another using web services ...
I will be really greatfull to those who help me....
Thanks..

  re: Copying An Image from a folder to another using Web services

Anand Malli replied to nikita kumar
06-Sep-10 03:36 AM
HI nikita,

Web service is nothing but and consumable application,what you do with web site can web service do right,but we are dealing with files on the server so you will need to make sure that you give enough rights to your those directories otherwise you will not be able to move your files,i have created web service just see the code below

using System;
using System.Web.Services;
using System.IO;
 
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Service : System.Web.Services.WebService
{
  public Service () {
 
    //Uncomment the following line if using designed components
    //InitializeComponent();
  }
 
  [WebMethod]
  public string HelloWorld() {
    return "Hello World";
  }
  [WebMethod]
  public bool MoveImage()
  {
    bool isMoved = true;
    try
    {
      File.Move("C:\\Folder1\\myfamily.JPG", "C:\\Folder2\\myfamily.JPG");
    }
    catch (Exception ex)
    {
      isMoved = false;
    }
    return isMoved;
  }
}

just see the move function,i have created two folders Folder1 and Folder2,initially i have drop one file in Folder1 and moving to Folder2 with our function,you can see whole process on below snapshot,here i have not added reference of this to my page,but i have invoked it directly,you can do it by add reference


just ping me with your feedback

thanxs

  re: Copying An Image from a folder to another using Web services

nikita kumar replied to Anand Malli
06-Sep-10 04:55 AM
Your code rocks....Thanks a lot for ur help.... u made my day...

  re: Copying An Image from a folder to another using Web services

Anand Malli replied to nikita kumar
06-Sep-10 04:56 AM
Hey niki...thxs for such awesome reply....
  re: Copying An Image from a folder to another using Web services
nikita kumar replied to Anand Malli
07-Sep-10 01:36 AM
Once again thanks for ur help...Can you just help me out telling me how it would work if the source and destination are in different servers....


Thanks..
  re: Copying An Image from a folder to another using Web services
Anand Malli replied to nikita kumar
07-Sep-10 01:41 AM
Hi Niki,

May be you can look for some WCF application which would be hosted on different machine and when called can just take the file from one computer to other computer...by usnig net.tcp protocol i think that would give you good start for this scenario

THXS
  re: Copying An Image from a folder to another using Web services
nikita kumar replied to Anand Malli
07-Sep-10 02:57 AM
Hi,
Thanks again for the help but I have not worked in WCF..do u have any idea if can be done using web services or not...do we have to use Streams in that case?
Create New Account
Copying An Image from a folder to another using Web services Hi, I Web Services.Can anybody help me how to copy an image file from a folder into another using web services . . . I below using System; using System.Web.Services; using System.IO; [WebService(Namespace = " http: / / tempuri.org / " )] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] / / To allow this Web Service to be called from script, using ASP NET AJAX, uncomment the following line. / / [System.Web.Script.Services.ScriptService] public class Service : System.Web.Services.WebService { public Service () { / / Uncomment the following line if using designed components the file from one computer to other computer. . .by usnig net.tcp protocol i think that would give you good start
TEXT" ); }); < / script > < / head > < body > < form id = "form1" runat = "server" > < div > < asp:Label ID = "lblName" runat = "server" Text = "Label" > < / asp:Label > < asp:HiddenField ID = "hdName" runat = "server" / > < asp:Button ID = "Button1" runat = "server" Text = "Button" OnClick = "Button1_Click" / > < / div height: 23px"> Suriyan < / td> <td style = "width: 81px; height: 23px;"> <asp:DropDownList ID = "Dropsuriyan" runat = "server" onchange = "changeText('lblR', this, 'Suriyan')" Width = "88px"> <asp:ListItem> 0< / asp:ListItem> <asp:ListItem> 1 asp:ListItem> <asp:ListItem> 2< / asp:ListItem> <asp:ListItem> 3< / asp:ListItem> <asp
Migration from ASP to ASP.net How to convert ASP site to ASP.NET site using C# http: / / www.asp.net / downloads / archived-v11 / migration-assistants / asp-to-aspnet hi, ASP.NET framework is very much different from unstrucured ASP and
What is application Control in asp.net What is application Control in asp.net? ASP.NET Web server controls are objects on ASP.NET Web pages that run when the page is requested and as a calendar controls, and controls that manage data connections. ASP.NET User Controls ASP.NET Web Server Controls ASP.NET Web
ASp .net, Asp What is the difference between Asp and Asp .net Looking at some of your other posts, it is pretty you can google it, you will find the difference between ASP and ASP.net. For your happiness i am providing the link http: / / www KB / aspnet / ASPNET_vs_ _ASP.aspx http: / / www.geekinterview.com / question_details / 15908 ASP.NET Versus ASP ASP.NET has better language support, a
Query Hi All what is worker process in asp.net?how we use this process? ASP.NET runs within a process known as the ASP.NET worker process. All ASP.NET functionality runs within the scope of this process. A regular Web server contains only a single ASP.NET worker process. This is different from both Web farms and
paypal process in asp.net paypal process in asp.net ASP.NET PayPal Control for Website Payments Standard was designed to be a single DLL ASP.NET Server Control for developing PayPal Website Payments Standard featured E for IPN / PDT events for more check this http: / / paypal-asp.net-3.5.fyxm.net / Here great sample code and tutorial
What is Http Handler in ASP.NET Can any one explain about What is Http Handler in ASP.NET An ASP.NET HTTP handler is the process (frequently referred to as the that runs in response to a request made to an ASP.NET Web application. The most common handler is an ASP.NET page handler that processes .aspx files. When users request an