Jump to content


Photo

Database path store...


  • Please log in to reply
2 replies to this topic

#1 Immortal55

Immortal55
  • Members
  • PipPipPip
  • Advanced Member
  • 59 posts

Posted 31 March 2006 - 06:12 AM

Alright, how in the world can I do this:

uploadforms.php - A form where you simply input a title, choose a file to upload, add a comment for the file, and select a catagory for the file. All of this info is then passed onto upload.php

upload.php - this takes the info from the forms puts it in a database, I know how to get all the text into the database, but how can i store the file location of the file in the DB (the location of the file on the server)? I cannot seem to get this, and I have been at it for weeks....

#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 31 March 2006 - 07:40 PM

When you upload a file it is put in a temporary location on the server. It is then up to to move this file (move_uploaded_file() ) to wherever to want to store it, renaming as required.

Having defined the path to where you want to store it, store that path in database. It's completely under your control.
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#3 craygo

craygo
  • Staff Alumni
  • Advanced Member
  • 1,973 posts
  • LocationRhode Island

Posted 31 March 2006 - 08:42 PM

If you keep all the files in the same place, don't even bother keeping the path in the database. Just call on it when you display the page.

If you have a directory called images then call it with the html

<img src="images/<?=$filename?>">

Ray




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users