'php upload a file into current directory
I want to upload an mp3 file and add it into a directory on my server. I am executing the php code from the server directory I want to add the file to. This is what I have so far:
$dir=basename(dirname(__FILE__));
$folder = dirname(dirname($_SERVER['SCRIPT_NAME']));
$file_name = $_FILES['upload']['name'];
//remember to remove this line
$file_name = "test.mp3";
$add_file[0] = "<a
href='//mydomain.com$folder/$dir/$file_name'>$file_name</a>";
$path = "https://nerjabible.com$folder/$dir/";
so I have $add_file[0] and I have the $path to append to. I have tried put and write append, but they all seem to work by opening a file, I am already in the directory, I just want to append my linked file to the existing links in the directory.
The mp3 is in a directory on my PC as a hyperlink playable file and I am using a file upload script to obtain the file which ends up in $file_name but as a non linked file name, so i want to append this into the same directory the script is running from, but as a linked file.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
