How to upload image from 1 server to other.

L

laziers

Hi,
I have 2 hostings one is in USA and the second is in the my country.
So, is there any way to do uploading users pictures from the 1st
server to secound without using FTP? Maybe upload control can do this?


bye
 
S

siccolo

maybe create a web service on the server with web method...something
like this?:
[WebMethod(Description = "Check Image Upload")]
public bool CheckImageUpload(byte[] byteImage,
out string ErrorInfo)
{

ImageUpload iu = new ImageUpload();

.....
.....
....

if (!iu.SaveImageToFile(byteImage, out ErrorInfo))
{
return false;
}

ErrorInfo = "";
return true;
}

catch (Exception ex)
{
ErrorInfo = ex.Message;
return true;
}
}


....
....
public bool SaveImageToFile(byte [] byteImage,
out string ErrorInfo)
{
try
{
string ImageFileFullPath = <path to
image>;

System.IO.MemoryStream ms =
new System.IO.MemoryStream(byteImage);

System.Drawing.Bitmap bitmap =

(System.Drawing.Bitmap)System.Drawing.Image.FromStream(ms);

bitmap.Save(ImageFileFullPath,
System.Drawing.Imaging.ImageFormat.Png);

ErrorInfo = "";
return true;
}
catch (Exception ex_save_image)
{
ErrorInfo = ex_save_image.Message;
return false;
}
}

....
....
 
L

laziers

maybe create a web service on the server with web method...something
like this?:
[WebMethod(Description = "Check Image Upload")]
public bool CheckImageUpload(byte[] byteImage,
out string ErrorInfo)
{

ImageUpload iu = new ImageUpload();

....
....
...

if (!iu.SaveImageToFile(byteImage, out ErrorInfo))
{
return false;
}

ErrorInfo = "";
return true;
}

catch (Exception ex)
{
ErrorInfo = ex.Message;
return true;
}
}

...
...
public bool SaveImageToFile(byte [] byteImage,
out string ErrorInfo)
{
try
{
string ImageFileFullPath = <path to
image>;

System.IO.MemoryStream ms =
new System.IO.MemoryStream(byteImage);

System.Drawing.Bitmap bitmap =

(System.Drawing.Bitmap)System.Drawing.Image.FromStream(ms);

bitmap.Save(ImageFileFullPath,
System.Drawing.Imaging.ImageFormat.Png);

ErrorInfo = "";
return true;
}
catch (Exception ex_save_image)
{
ErrorInfo = ex_save_image.Message;
return false;
}
}

...
...

oh, thats a good idee :)
 
L

laziers

maybe create a web service on the server with web method...something
like this?:
[WebMethod(Description = "Check Image Upload")]
public bool CheckImageUpload(byte[] byteImage,
out string ErrorInfo)
{

ImageUpload iu = new ImageUpload();

....
....
...

if (!iu.SaveImageToFile(byteImage, out ErrorInfo))
{
return false;
}

ErrorInfo = "";
return true;
}

catch (Exception ex)
{
ErrorInfo = ex.Message;
return true;
}
}

...
...
public bool SaveImageToFile(byte [] byteImage,
out string ErrorInfo)
{
try
{
string ImageFileFullPath = <path to
image>;

System.IO.MemoryStream ms =
new System.IO.MemoryStream(byteImage);

System.Drawing.Bitmap bitmap =

(System.Drawing.Bitmap)System.Drawing.Image.FromStream(ms);

bitmap.Save(ImageFileFullPath,
System.Drawing.Imaging.ImageFormat.Png);

ErrorInfo = "";
return true;
}
catch (Exception ex_save_image)
{
ErrorInfo = ex_save_image.Message;
return false;
}
}

...
...

btw, what is faster? web service or file transfare [ftp] ?
 
S

siccolo

maybe create a web service on the server with web method...something
like this?:
[WebMethod(Description = "Check Image Upload")]
    public bool CheckImageUpload(byte[] byteImage,
                                out string ErrorInfo)
    {
        ImageUpload iu = new ImageUpload();

            if (!iu.SaveImageToFile(byteImage, out ErrorInfo))
            {
                return false;
            }
            ErrorInfo = "";
            return true;
        }
        catch (Exception ex)
        {
            ErrorInfo = ex.Message;
           return true;
        }
    }
...
...
public bool SaveImageToFile(byte [] byteImage,
                                out string ErrorInfo)
    {
        try
        {
            string ImageFileFullPath = <path to
image>;
            System.IO.MemoryStream ms =
                    new System.IO.MemoryStream(byteImage);
            System.Drawing.Bitmap bitmap =

            bitmap.Save(ImageFileFullPath,
System.Drawing.Imaging.ImageFormat.Png);
            ErrorInfo = "";
            return true;
        }
        catch (Exception ex_save_image)
        {
            ErrorInfo = ex_save_image.Message;
            return false;
        }
    }

btw, what is faster? web service or file transfare [ftp] ?- Hide quoted text -

- Show quoted text -

SOAP/HTTP versus FTP? in general FTP is faster...but...FTP is more
efficient for large(er) files, and HTTP is for smaller...but FTP and
HTTP based on the same TCP/IP...but, it all depends on the bandwith,
servers, application etc etc..my 3cents:)
 
L

laziers

SOAP/HTTP versus FTP? in general FTP is faster...but...FTP is more
efficient for large(er) files, and HTTP is for smaller...but FTP and
HTTP based on the same TCP/IP...but, it all depends on the bandwith,
servers, application etc etc..my 3cents:)

ok :) thx for answare

bye
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,181
Messages
2,570,970
Members
47,537
Latest member
BellCorone

Latest Threads

Top