help on uploading files and adding the paths to the database

I am trying to be able to upload a video, the name of the video, an image/thumbnail , and and a description and INSERT it into the database.

I am new to this but it doesn’t seem like a hard code to write, but…I’m having absolutely no luck of course.
I know how to go about putting the actual video in the database (I think) but I actually want to just put the file path in the database and not the file itself. I’ve been browsing the internet for hours trying to figure this out with no luck, anyone here know some code I can use to go about doing this? any and all help would be greatly appreciated.

Are you able to share with us what you have done so far as far as coding?
When you upload the video to your server you want to just get the filepath and save it.
Your upload code should point to where the video is getting uploaded to, just take that path, then the filename and you have yourself a link.

well once you create the form for uploading you should be pointing it to a php file that is similar to this:
[php]<?php

if(!is_dir(“uploads/”)){
mkdir(“uploads/”, 0777);
}

$uploaddir = 'uploads/';  
$file = $uploaddir . basename($_FILES['uploadfile']['name']);   
  
if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) {  
  echo "success";  
} else {  
    echo "error";  
}  
?>[/php]

then from there you have the link $file

I forgot to add if you are having issues with your server not chmodding the directory to 777 then just :
chmod(“uploads/”, 0777); just below the mkdir(“uploads/”, 0777); :wink:

Sponsor our Newsletter | Privacy Policy | Terms of Service