473,506 Members | 16,994 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to upload image from 1 server to other.

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
Feb 4 '08 #1
5 1098
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.FromSt ream(ms);

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

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

....
....
Feb 4 '08 #2
On 4 Lut, 16:44, siccolo <aleks...@hotmail.comwrote:
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.FromSt ream(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 :)
Feb 4 '08 #3
On 4 Lut, 16:44, siccolo <aleks...@hotmail.comwrote:
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.FromSt ream(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] ?
Feb 4 '08 #4
On Feb 4, 4:43*pm, "lazi...@gmail.com" <lazi...@gmail.comwrote:
On 4 Lut, 16:44,siccolo<aleks...@hotmail.comwrote:


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.FromSt ream(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] ?- 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:)
Feb 5 '08 #5
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
Feb 6 '08 #6

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

Similar topics

3
11737
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
15
5302
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
0
4737
by: SEMIH DEMIR | last post by:
Sitelerden birinde verilen yabancı kaynakli bir scriptti duzenledim yanlız birseyin içinden bir turlu cıkamadım işin aslı ilk defa persistin upload componentini kullanacam yanlız suanki haliyle...
9
3815
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web...
4
9055
by: SammyBar | last post by:
Hi all, I wonder is it possible to upload the content of an <imgfield to a server. The content of the <imgwas downloaded from a web site different from the one it should be uploaded. The image...
0
7103
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7307
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,...
1
7021
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
7478
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5614
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,...
1
5035
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...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
755
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.