Hi Friends,

If any body know how to upload a file in PHP and store it in postgresql database tables and retrive the contents from the postgres database and download it.

If any body give the code snipset or the resource link I will thankful for that.

I expect the solution soon...

Regards,
Palanisamy

    In manual there is no code level discussion with file upload and database creation for storing the file in Postgres.

      Handling file uploads has nothing to do with Prostgresql. Database creation has nothing to do with PHP. But there are lots of examples of each of these things in the manual. What, specifically, are you having trouble with?

      By the way, storing files in databases is generally a bad idea, IMHO. Filesystems are uniquely suited for storing files. Databases are great for storing filenames and the locations of those files, though.

        When upload the file we can save the file in postgres by pack the file and store the content in database, for that we can use pack() function available in PHP. Similary we can use unpack() function for retriving the file and download it.

                My question what datatype we will use for storing the packed file in postgresql database.

        We will use bytea available in postgre, but it is not an efficient use. Because when pack the image file as uploaded in PHP. Its size is around 2 MB. That is it exists the maximum file size in PHP. But the file size is 900KB only.

        I need another method to store file in postgre sql database.

          Write a Reply...