HTTP.Put Error?

Giganews Newsgroups
Subject: HTTP.Put Error?
Posted by:  Jesse (nospam@fake.com)
Date: Mon, 2 Oct 2006

I'm trying to write a Delphi 5 program that will allow someone to upload a
file to our server. When I implement the .put method, I get the error,
"HTTP/1.1 501 Not Implemented".  What does this mean?  Following is my
Delphi 5 code:

procedure TDLUpdMainFrm.UploadBtnClick(Sender: TObject);
Var
  fs : TFileStream;
  lFileSent : Boolean;
  cError, cCmd : String;
  cFile : String;
begin
  if ULFile.Text = '' then
  Begin
      MessageBox(GetActiveWindow,'You must specify a file name','',MB_OK +
MB_ICONINFORMATION);
      ULFile.SetFocus;
      Exit;
  end;

  if not FileExists(ULFile.Text) then
  Begin
      MessageBox(GetActiveWindow,'The file you have specified does not
exist','',MB_OK + MB_ICONINFORMATION);
      ULFile.SetFocus;
      Exit;
  end;

  { Upload the update }
  cFile := ExtractFileName(ULFile.Text);
  fs := TFileStream.Create(ULFile.Text, fmCreate);
  cError := '';
  cCmd := 'http://www.mysite.com/myfolder/' + cFile;
  try
      HTTP.Put(cCmd,fs);
      lFileSent := True;
  except
      on E: Exception do
      Begin
        cError := e.Message;
        lFileSent := False;
      end;
  end;
  fs.Free;

  if lFileSent then
      MessageBox(GetActiveWindow,'The file has been sent!','',MB_OK +
MB_ICONINFORMATION)
  else
  Begin
      Desc.Caption := 'Unable to send file: ' + cError;
      Exit;
  end;
  Close;
end;

Thanks,
Jesse

Replies