[fpc-pascal] CGI file upload

ABorka fpc-devel at aborka.com
Mon May 24 18:28:47 CEST 2010


On 5/23/2010 08:57, Vannus wrote:
> How do you get cgi uploads to work??
>
> Im using TModuledCGIApplication
>
> procedure TCGIDatamodule1.DataModuleCGIRequest(Sender: TObject);
> begin
>    // upload handling
>    writeln('<div>filenamevar:
> '+application.requestvariables['file']+'</div>');  // works when get but
> post is just blank
>    writeln('<div>filenamefile:
> '+application.UploadedFileName('file')+'<div>');  // doesn't work with
> get or post, just comes out blank
>
> // upload html
>    writeln('<form action="'+extractfilename(application.Params[0])+'"
> method="post">');
>    writeln('Upload File: <input type="file" name="file" /> <input
> type="submit" value="Submit"/>');
>    writeln('</form>');
> end;
>
>
> TIA
> - V

There is an example project (CGI and Apache mod) in Lazarus under 
/components/fpweb/demo/fptemplate/fileupload/ you can use.

AB




More information about the fpc-pascal mailing list