Hi,
I have updated select (listBox1) with files from folder.
How to move selected file from one folder in to another one?
For updating listBox with files a have this code:
In html i have this:
`<select id=”listBox1″ name=”listBox1″ class=”listBox” multiple></select>
`<input type=”submit” id=”buttonMove1″ name=”buttonMove1″ class=”buttonMove1″ value=”Move”></input>
in ( get-images.php ) file i have this:
[code]
<?php
if (isset($_POST[‘dir’])) {
$dir = $_POST[‘dir’];
$files = glob($dir . ‘*’);
foreach ($files as $file) {
echo ‘<option data-dir=”‘ . $dir . ‘”>’ . pathinfo($file, PATHINFO_BASENAME) . ‘</option>’;
}
}
?>
and in Jquery-Ajax i have this:
[code]
$(function(){
$(“#button1”).click(function(e){
$.ajax({
url: ‘get-images.php’,
type: ‘POST’,
data: { dir: “./osaasto1/maanantai/”},
success: function (response) {
$(‘#listBox1’).empty().append(response);
}
});
[code]
Now i would like to move selected file from path: “./osaasto1/maanantai/” to path: “./osaasto1/valmis/” when buttonMove1 is clicked, and remove selected option from listBox1 .