How to upload image from 1 server to other.

  • Thread starter Thread starter laziers
  • Start date Start date
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
 
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;
}
}

....
....
 
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 :)
 
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] ?
 
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:)
 
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
 
Back
Top