Re: use fopen iso-8859-1 resource - Mailing list pgsql-general

From David G. Johnston
Subject Re: use fopen iso-8859-1 resource
Date
Msg-id CAKFQuwZHigL6TvOOjXmyeXfz9EOdFarh1CHcnekmTwOuERphVA@mail.gmail.com
Whole thread Raw
In response to use fopen iso-8859-1 resource  (ourdiaspora <ourdiaspora@protonmail.com>)
List pgsql-general
On Fri, Aug 27, 2021 at 2:59 PM ourdiaspora <ourdiaspora@protonmail.com> wrote:
Please what is the syntax to assign an unknown file name to the 'fopen' function?


There isn't one as it would make no sense - how is it supposed to open a file if there is no filename provided to open?

You have to set things up yourself so that the content you want to open exists in a file at a known location and then pass that location to the function.  In particular, in a web server context, that means taking the request input from the client that represents a file and saving it somewhere first - then opening that saved content.  If the user is supplying a suggested file name for the content you can incorporate that.  You can also ignore it and just make something up.  It doesn't matter (other than concerns about overwriting existing files).  But whatever name you choose to give to the newly created file on the server is the one you pass to fopen.  The name/location of the file on the client machine is irrelevant - the server cannot even see that machine (or, at least should not care even if it technically can) per the fundamental architectural principle of "client-server" design.

David J.

pgsql-general by date:

Previous
From: ourdiaspora
Date:
Subject: Re: use fopen iso-8859-1 resource
Next
From: Tom Lane
Date:
Subject: Re: Can we get rid of repeated queries from pg_dump?