rejetto forum

procedure getUploadDestinationFileName()

Mars · 1 · 1835

0 Members and 1 Guest are viewing this topic.

Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2039
    • View Profile
 When we use the event [upload name] to reappoint a file, and when 'menu' > 'upload' - > 'number files on upload' is unchecked, then the file is reappointed well in upload success but not in the reality. because of the line:
  if not numberFilesOnUploadChk.checked then exit; , then the last assignFile(data.f^, data.uploadDest); is never executed.

The code needs to be changed to

 procedure getUploadDestinationFileName();
    i: integer;
    fn, ext, s: string;

  assignFile(data.f^, data.uploadDest);

  // see if an event script wants to change the name
  s:=eventToFilename('upload name', ['%item-size%','gus '+inttostr(]);

  if validFilepath(s) then // is it valid anyway?
    if pos('\', s) = 0 then  // it's just the file name, no path specified: must include the path of the current folder
    // ok, we'll use this new name

  if not numberFilesOnUploadChk.checked then exit;
    setLength(fn, length(fn)-length(ext));
    while fileExists(data.uploadDest) do
      data.uploadDest:=format('%s\%s (%d)%s', [f.resource, fn, i, ext]);

  assignFile(data.f^, data.uploadDest);
  end; // getUploadDestinationFileName

« Last Edit: July 28, 2009, 09:31:25 AM by Mars »