Note that there are some explanatory texts on larger screens.

plurals
  1. POCreating a folder with PHP using input values
    primarykey
    data
    text
    <p>I am trying to create a folder in PHP, by calling a value. Creating one works fine. But once I try calling the value instead and concatenating it with the existing folder, it won't work. I have tried several things. </p> <p>For example, I want to be able to have someone type in a name for their folder in an input field, so that they may choose what will the name of the folder be. For example, they could write on the website "mypics", and when I access my ftp program, I would now see images/mypics/</p> <p>As for the HTML portion, I have this (check the fiddle for the rest of it <a href="http://jsfiddle.net/GF6qk/" rel="nofollow">http://jsfiddle.net/GF6qk/</a> ):</p> <pre><code>&lt;input type="text" id="folder" name="folder"&gt; </code></pre> <p>As for the PHP aspect, I have the following</p> <pre><code>&lt;?php // We're putting all our files in a directory called images. // Desired folder structure $folder = $_POST['folder']; $dirPath = 'images/'.$folder; $result = mkdir($dirPath, 0755); if ($result == 1) { echo $dirPath . " has been created"; } else { echo $dirPath . " has NOT been created"; } //$image_name = ''; $uploaddir = 'images'; // The posted data, for reference $file = $_POST['value']; $name = $_POST['name']; // Get the mime $getMime = explode('.', $name); $mime = end($getMime); // Separate out the data $data = explode(',', $file); // Encode it correctly $encodedData = str_replace(' ','+',$data[1]); $decodedData = base64_decode($encodedData); ?&gt; </code></pre> <p>I have also used this line (which was the original line I tried in the above code, which I then changed).</p> <pre><code>$dirPath = 'images/$folder'; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload