Uploading to specific field in datatbase

Reply

Join Date: Oct 2009
Posts: 25
Reputation: SuntechWebsites is an unknown quantity at this point 
Solved Threads: 0
SuntechWebsites SuntechWebsites is offline Offline
Light Poster

Uploading to specific field in datatbase

 
0
  #1
34 Days Ago
Heres one for ya...
Lets say you have a mysql database with multiple entries (clients). Each one has a field for name, username ect. There is also one for say storing a doc file for billing. How can I make it so I can upload a file to just a specific clients "billing" field in the database?
Oooooooor, do I store these files on the server? Which would bring me to the question of how to upload the files to a specific directory though a web browser.
I am trying to figure out the best way to create an "Admin control panel" to be able to update the clients without having to use an ftp program.
Mabey thats just the best way. I am looking for suggestions and code. Im still pretty new at this.
I also have a post looking for ways to display these files for the clients on thier login page. I used the echo statment and only got a coded version of the file.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 1,030
Reputation: ardav will become famous soon enough ardav will become famous soon enough 
Solved Threads: 131
ardav's Avatar
ardav ardav is online now Online
Veteran Poster
 
-1
  #2
33 Days Ago
You could save all the info in a blob field (no physical file - just some encoded info in a field, which can produce a file on demand), OR just store an url/path for a physical file stored in a certain folder.

E.g.

users table
id (PK)
username
... etc ...

billing table
id (PK)
user_id (Foreign Key on id in users)
dated (billing date)
amount (Billing Amount)
reconciled (Y/N)
invoice_file ***(this is where you store the file's path)
...other fields...

You shoud be able to store a pdf file of the invoice, otherwise you could produce it dynamically from billing info - you can use something like fpdf for either approach
Happy Humbugging Christmas
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 25
Reputation: SuntechWebsites is an unknown quantity at this point 
Solved Threads: 0
SuntechWebsites SuntechWebsites is offline Offline
Light Poster
 
0
  #3
30 Days Ago
Thanks. Thats pretty much what I figured. Works good.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 443
Reputation: Atli is on a distinguished road 
Solved Threads: 56
Atli's Avatar
Atli Atli is offline Offline
Posting Pro in Training
 
0
  #4
30 Days Ago
Hey.

I wrote an article that explains in detail how you would upload a file into a MySQL database. (Linkage).
In case you choose to go that route.
Please do not ask for help in a PM. Use the forums.
And use [code] tags!
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 25
Reputation: SuntechWebsites is an unknown quantity at this point 
Solved Threads: 0
SuntechWebsites SuntechWebsites is offline Offline
Light Poster
 
0
  #5
29 Days Ago
Ok, now, how can I password protect the directory that holds the file so its not accessable by others, but is to the logged in user?
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 443
Reputation: Atli is on a distinguished road 
Solved Threads: 56
Atli's Avatar
Atli Atli is offline Offline
Posting Pro in Training
 
0
  #6
28 Days Ago
Originally Posted by SuntechWebsites View Post
Ok, now, how can I password protect the directory that holds the file so its not accessable by others, but is to the logged in user?
You could store the files outside the web-root, so they can't be reached by a HTTP request, and have a PHP file that forwards them to users that are logged in.

There are also ways to use .htaccess files (Apache only) to restrict access to specific directories, but that won't integrate with PHP as easily.
Please do not ask for help in a PM. Use the forums.
And use [code] tags!
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC