Hi
 
I have decided to have a go at cgi-expert, (inspired by a file-upload requirement).
 
Going through the examples, i found exactly what i wanted.  (FileUpload1D.dpr)
 
This little example saves the file to the same directory as the application.  Since i dont want my clients to upload to the cgi-bin directory, i have been trying to change the code to save to c:\apache\docs\*
where * is the appropriate companie's doc dir.
 
to do this i have replace the code
Dest:=ExtractFileDir(ExeOrDllPath) + '\'+ExtractFileName(FormVar('FILE',''));
 
with:
//get this company's directory name and set upload target to there
        with IBQuery1 do
        begin
            Close;
            SQL.text :=
                format('Select Directory from company where companyID = %d',
                [1]);
            try
                Open;
            except
                on E: Exception do
                begin
                    PutLine('Database Error = ' + E.Message);
                    exit;
                end;
            end;
            ss :=
                lowercase(trim(FieldByname('Directory').AsString));
            close;
        end;
        Dest := 'c:\apache\docs' + '\' + ss;
 
Seems pretty straight forward to me, however this code:
 
RenameFile(FormVar('FILE_FILENAME', ''), Dest)
 
is failing, and i receive the message that the file could not be renamed, specifically:
 
Failed to rename file:c:\apache\docs\taupofs,C:\My Documents\Invoices\LWC.doc,C:\Apache\cgi-bin\Temp\zn5936273.tmp
 
How is my resulting destination filename so different that it causes this error?  Am i missing something??
 

 
 
Tracey
Software Developer / Web Master
Logis
[EMAIL PROTECTED]
(025) 213-1065

Reply via email to