Note that there are some explanatory texts on larger screens.

plurals
  1. POFiles not being uploaded in dynamically created folders/subfolders
    primarykey
    data
    text
    <p>i need help to solve this problem Files not being uploaded in dynamically created folders/subfolders!</p> <p>creating a dynamically <code>subfolder</code> using <code>input type text</code> and when i uploaded file moved to <code>uploads folders</code> but not moved to <code>subfolder</code> which is create using <code>input type text?</code></p> <p>but dynamically creating function working fine and also showing me folder which is typed in the textbox into the upload folder</p> <p><strong>Here My Code</strong></p> <pre><code>//creating dynamically subfolders $folder = $_POST['folder']; foreach( $folder as $key =&gt; $value){ $dirPath = 'uploads/'.$value; $result = mkdir($dirPath); } if ($result == '1') { //file move on function $target_path = 'uploads/'.$results; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } } else { echo $dirPath . " has NOT been created"; } } &lt;form method="post" enctype="multipart/form-data"&gt; &lt;input name="uploadedfile" type="file" /&gt;&lt;br /&gt; &lt;input type="text" id="folder" name="folder"&gt;&lt;br /&gt; &lt;input type="submit" name="test" value="Upload File" /&gt; &lt;/form&gt; </code></pre> <p><strong>My Problem Is Solved Now I Have Completed My Script</strong> </p> <pre><code>//creating a folder $folder = $_POST['folder']; $dirPath = 'uploads/'.$folder; $result = mkdir($dirPath); if ($result == '1') { //file move on $target_path = $dirPath .'/' . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } } else { echo $dirPath . " has NOT been created"; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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