Click here to Skip to main content
15,895,798 members
Home / Discussions / C#
   

C#

 
QuestionWindows or Console application target for Windows Service? Pin
JoeSchmoe00726-Jul-10 3:43
JoeSchmoe00726-Jul-10 3:43 
AnswerRe: Windows or Console application target for Windows Service? Pin
darkelv26-Jul-10 4:04
darkelv26-Jul-10 4:04 
AnswerRe: Windows or Console application target for Windows Service? [modified] Pin
PIEBALDconsult26-Jul-10 6:55
mvePIEBALDconsult26-Jul-10 6:55 
QuestionMouse Hover/Leave with many controls and status strip message Pin
Blubbo26-Jul-10 3:05
Blubbo26-Jul-10 3:05 
AnswerRe: Mouse Hover/Leave with many controls and status strip message Pin
Blubbo26-Jul-10 4:16
Blubbo26-Jul-10 4:16 
QuestionFTP transfer corrupts .PNG files Pin
anthasaurus26-Jul-10 2:06
anthasaurus26-Jul-10 2:06 
AnswerRe: FTP transfer corrupts .PNG files Pin
Nagy Vilmos26-Jul-10 2:18
professionalNagy Vilmos26-Jul-10 2:18 
GeneralRe: FTP transfer corrupts .PNG files Pin
anthasaurus26-Jul-10 23:10
anthasaurus26-Jul-10 23:10 
Thanks for your response Nagy.

I have modified my code to use BinaryReader.

I'm still able to transfer the files, but they end up being ~60% the size of the originals. I'm still unable to view the files due to corruption. Please can you advise whether my code is trying to do the right thing or not (see below)?

FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://ftpuser...etc");
request.UsePassive = true;
request.UseBinary = true;
request.Method = WebRequestMethods.Ftp.UploadFile;
request.Credentials = new NetworkCredential("username", "password");

BinaryReader br = new BinaryReader(File.Open(fileLocalDir, FileMode.Open));

FileInfo info = new FileInfo(fileLocalDir);
byte[] testArray = new byte[info.Length];

int i;
for (i = 0; i < info.Length; i++)
{
    testArray[i] = br.ReadByte();
}

request.ContentLength = i;

try
{
    Stream requestStream = request.GetRequestStream();
    requestStream.Write(testArray, 0, i);
    requestStream.Close();

    FtpWebResponse response = (FtpWebResponse)request.GetResponse();
    response.Close();
}


Regards,
Anthony
QuestionSelection Formula in crystal report Pin
Nikhil Bhivgade26-Jul-10 1:21
professionalNikhil Bhivgade26-Jul-10 1:21 
QuestionWhat API to use? Pin
c242326-Jul-10 0:54
c242326-Jul-10 0:54 
AnswerRe: What API to use? Pin
Eddy Vluggen26-Jul-10 1:19
professionalEddy Vluggen26-Jul-10 1:19 
GeneralRe: What API to use? Pin
c242326-Jul-10 1:28
c242326-Jul-10 1:28 
GeneralRe: What API to use? Pin
Eddy Vluggen26-Jul-10 1:41
professionalEddy Vluggen26-Jul-10 1:41 
GeneralRe: What API to use? Pin
c242326-Jul-10 3:08
c242326-Jul-10 3:08 
GeneralRe: What API to use? Pin
Eddy Vluggen26-Jul-10 3:11
professionalEddy Vluggen26-Jul-10 3:11 
GeneralRe: What API to use? PinPopular
Pete O'Hanlon26-Jul-10 3:51
mvePete O'Hanlon26-Jul-10 3:51 
GeneralRe: What API to use? Pin
c242326-Jul-10 5:32
c242326-Jul-10 5:32 
Questionbackground image for richtextbox like watermark Pin
mobasher26-Jul-10 0:45
mobasher26-Jul-10 0:45 
AnswerRe: background image for richtextbox like watermark Pin
Ravi Bhavnani26-Jul-10 2:00
professionalRavi Bhavnani26-Jul-10 2:00 
GeneralRe: background image for richtextbox like watermark Pin
mobasher26-Jul-10 2:50
mobasher26-Jul-10 2:50 
AnswerRe: background image for richtextbox like watermark Pin
Eddy Vluggen26-Jul-10 3:36
professionalEddy Vluggen26-Jul-10 3:36 
QuestionOn drawing rectangle how to scroll down the picture box? Pin
Nivas8226-Jul-10 0:30
Nivas8226-Jul-10 0:30 
Questionupdate panel in content page works just on first time click? Pin
220825-Jul-10 23:49
220825-Jul-10 23:49 
AnswerRe: update panel in content page works just on first time click? Pin
Jeroenh26-Jul-10 0:03
Jeroenh26-Jul-10 0:03 
GeneralRe: update panel in content page works just on first time click? Pin
220826-Jul-10 0:20
220826-Jul-10 0:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.