CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 1999
    Posts
    5

    Need help with CInternetFile::Write

    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;





  2. #2

    Re: Need help with CInternetFile::Write

    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.


  3. #3
    Join Date
    Jul 1999
    Posts
    5

    Re: Need help with CInternetFile::Write

    I have all the imaginable rights(it's my personnal ftp site). I've tried different directories, sites.... and still nothing


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured