Click to See Complete Forum and Search --> : Need help with CInternetFile::Write


Avenger
July 21st, 1999, 03:12 PM
Downloading a file is no problem, but uploading a file is another story. The code is almost the same, instead of reading you write, but it doesn't work. If I trace into it, it looks like it's going to work, but when I close the file, the trace stops there and freezes. But if I run the program normaly, is frezzes the first time it goes into the while loop. This is what I have :


CInternetFile *iFile; //remote file
CFile lFile; //local file
char buf[512];
UINT end;
CDownloadDialog *dlg = (CDownloadDialog*) pParam; //I'm in a thread

iFile = dlg->ftp->OpenFile(remoteFile, GENERIC_WRITE, FTP_TRANSFER_TYPE_BINARY, 1);
if(iFile) {
if(lFile.Open(localFile, CFile::modeRead)) {
memset(buf, 32, 512);
end = lFile.Read(buf, 512);

while( end == 512 ) {
//iFile->WriteString(&buf); //doesnt' work either
iFile->Write(&buf, end);
iFile->Flush();
end = lFile.Read(buf, 512);
}
}
}
lFile.Close();
iFile->Close();
delete iFile;

Imran Rajwani
July 21st, 1999, 05:29 PM
does the ftp account allows write access ?
try using ftp client and login to the ftp server and try to save a file there. If you can't then you dont have permission to write.

Avenger
July 21st, 1999, 06:16 PM
I have all the imaginable rights(it's my personnal ftp site). I've tried different directories, sites.... and still nothing