Donate Share

ftptask

Tracker: Bugs

5 Binary uploads seem to fail - ID: 1796868
Last Update: Comment added ( ecu )

I have been trying to upload through FtpTask a precompiled ASP.NET website;
but I get server side errors when I try to launch the website. Yet, when I
do the exact same operation with another FTP client, the website run fine.

Joannès


Joannes Vermorel ( joannes ) - 2007-09-18 07:21

5

Closed

None

Nobody/Anonymous

None

None

Public


Comments ( 2 )

Date: 2009-03-24 14:47
Sender: ecuProject Admin

I guess it's fixed in v.0.6 (will be released soon).


Date: 2008-04-14 18:06
Sender: dmiser


I added the following code (grabbed from
http://www.codeproject.com/KB/IP/SimpleFTPDemo.aspx), and this will upload
all of the files in binary mode. Here's the entire method:

private FtpAnswer UploadFile(string filename, Uri remoteFilename)
{
LogFormat("Uploading file: '{0}'", remoteFilename);

// Get the object used to communicate with the server.
FtpWebRequest request = CreateRequest(remoteFilename,
WebRequestMethods.Ftp.UploadFile);

request.UseBinary = true;
FileInfo fileInf = new FileInfo(filename);
request.ContentLength = fileInf.Length;

int buffLength = 2048;
byte[] buff = new byte[buffLength];
int contentLen;

FileStream fs = fileInf.OpenRead();
Stream requestStream = request.GetRequestStream();
contentLen = fs.Read(buff, 0, buffLength);

// Till Stream content ends
while (contentLen != 0)
{
// Write Content from the file stream to the
// FTP Upload Stream
requestStream.Write(buff, 0, contentLen);
contentLen = fs.Read(buff, 0, buffLength);
}

// Close the file stream and the Request Stream
requestStream.Close();
fs.Close();

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

FtpAnswer answer = new FtpAnswer(response.StatusDescription);

response.Close();

return answer;
}





Attached File

No Files Currently Attached

Changes ( 3 )

Field Old Value Date By
status_id Open 2009-03-24 14:47 ecu
allow_comments 1 2009-03-24 14:47 ecu
close_date - 2009-03-24 14:47 ecu