I'm successfully uploading some files to a folder and saving the path in table.
If I display the file's path in an html table, hovering over it, the address on deck to be linked always has my domain.com/folder infront of the local path (which also is showing the domain name). So, it's domain/partialpath/domain_again/fullpath.
The $_POST and such works great. This is the related code to the file upload.
$currentDirectory = getcwd();
$uploadDirectory = "/files/";
$fileName = $_FILES['the_file']['name'];
$tmpName = $_FILES['the_file']['tmp_name'];
$fileSize = $_FILES['the_file']['size'];
$fileType = $_FILES['the_file']['type'];
$uploadPath = $currentDirectory . $uploadDirectory . $fileName;
$cleaned = urlencode($uploadPath);
move_uploaded_file($tmpName, $uploadPath);
$batch = ("INSERT INTO filings VALUES ($cleaned)");
I was using urlencode() because some files have spaces and characters in their names, and I cannot tell if that's interfering with the url path or not.
Is the best convention to use assign a variable the text string of the path? $path = "/blah/blah/blah"?
Also, since this is the first project like this I've done, I'm curious why the browser puts my domain ahead of every path when hovering.