Recent

Author Topic: is it possible to upload files via cgi?  (Read 7179 times)

nullpointer

  • New Member
  • *
  • Posts: 35
  • impossible is nothing
    • tauhidslab
is it possible to upload files via cgi?
« on: July 20, 2018, 01:21:39 pm »
i just made a simple web based project cgi using fpc. the project has successfully retrieved data from the html input form and saved it to the database through POST method. then I intend to add upload file feature through html form. Can this be done via cgi?

this is an example of the project I created : https://github.com/tauhidcp/FPCWeb-CRUDMySQL
« Last Edit: July 20, 2018, 01:23:41 pm by nullpointer »

sash

  • Sr. Member
  • ****
  • Posts: 366
Re: is it possible to upload files via cgi?
« Reply #1 on: July 21, 2018, 11:43:10 pm »
Whether your server app is CGI or another type, it has nothing to do with upload ability.

Typically, to upload file your html form should contain <input type="file"> field(s) and submit request via POST.
Then, at server side, you should check Request.Files and process them accordingly.

Note, if your app is behind proxy (or cgi host server), that server config options should be checked (like POST size, file upload limits).
Lazarus 2.0.10 FPC 3.2.0 x86_64-linux-gtk2 @ Ubuntu 20.04 XFCE

nullpointer

  • New Member
  • *
  • Posts: 35
  • impossible is nothing
    • tauhidslab

 

TinyPortal © 2005-2018