Jump to content

Database path store...


Immortal55

Recommended Posts

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....
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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

[code]<img src="images/<?=$filename?>">[/code]

Ray
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.