LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 12-30-2003, 10:34 AM   #1
jacksmash
Member
 
Registered: Nov 2003
Location: Ontario, Canada
Distribution: Ubuntu
Posts: 269

Rep: Reputation: 30
PostgreSQL (or just SQL) question


I have a simple yes/no answer question:

Is it possible to allow a user to upload a file (let's say a text file for this example) and then store it in a table along with the user's other information?

If the answer is yes - can someone give me a hint as to how? I'm using PHP for the scripting language. But when I look at the storage types for PostgreSQL, there doesn't seem to be anything that would suggest storing a file in a table.

Thanks for any help!
 
Old 12-30-2003, 11:06 AM   #2
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 50
uploading with PHP.

i dont know about PostgreSQL but mysql has the types {TINY|MEDIUM|LARGE}TEXT and BLOB, i would use TEXT for the text files and BLOB for binary files such as pictures.
 
Old 12-30-2003, 11:12 AM   #3
jacksmash
Member
 
Registered: Nov 2003
Location: Ontario, Canada
Distribution: Ubuntu
Posts: 269

Original Poster
Rep: Reputation: 30
Yeah, I don't see those available on the list of types - perhaps it is just disabled on our server at school for protection.

Thanks for the suggestion though.
 
Old 12-30-2003, 11:27 AM   #4
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 50
ive just looked at the postgreSQL documentation and version 6.3(earliest manual on website) and above seems to have the text type available, are you sure the text type doesnt work? what happens if you run?

create table texttest (testfield text);
 
Old 12-30-2003, 11:34 AM   #5
jacksmash
Member
 
Registered: Nov 2003
Location: Ontario, Canada
Distribution: Ubuntu
Posts: 269

Original Poster
Rep: Reputation: 30
Yes that works, but in my documentation it says it is just a variable length string.
Would that work for uploading a file and storing it do you think?
 
Old 12-30-2003, 11:40 AM   #6
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 50
wouldnt work for a binary file but i think it would be perfect with a text file, your other choice is to store the uploaded file somewhere and store a path to it in the database.
 
Old 12-30-2003, 11:46 AM   #7
jacksmash
Member
 
Registered: Nov 2003
Location: Ontario, Canada
Distribution: Ubuntu
Posts: 269

Original Poster
Rep: Reputation: 30
sounds good - thanks for all your help
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MS SQL Server to PostgreSQL?? cppkid Programming 1 09-08-2004 05:53 AM
Embedded SQL -Unable to connect to PostgreSQL database vikram_cvk Linux - Software 1 05-30-2004 07:14 AM
PostgreSQL: Installed 7.4 on Redhat 9.0 but can't run pgcrypto.sql. gregmcavoy Linux - Software 0 12-29-2003 12:37 PM
PostgreSQL: executing a .SQL file from command line? J_Szucs Linux - Software 0 09-25-2003 12:49 AM
PostgreSQL question digital bots Linux - Newbie 3 06-18-2002 01:37 AM


All times are GMT -5. The time now is 01:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration