if ($photos = opendir('../img/projects/')) {
while (false !== ($entry = readdir($photos))) {
if (strpos($entry, '0') !== false)
{
array_push($photosArr,$entry);
}
}
$n = 1;
foreach ($photosArr as $photo) {
$name = '0'. '.' . $n . '.jpg';
rename(('../img/projects/' . $photo -> name) , $name);
$n++;
}
closedir($photos);
}
el.querySelector('.workspace__main-images .workspace__main-images-toolbar .workspace__main-images-toolbar-settings form input[type=file]').onchange = function () {
let image,
data = new FormData();
image = this.files[0];
data.append('image',image);
$.ajax({
type: "POST",
url: "./admin.php",
contentType: false,
processData:false,
data: data,
});
}
if(isset($_FILES['image'])) {
copy($_FILES['image']['tmp_name'], '../img/' . '13124' . '.PNG');
}
el.querySelector('.workspace__main-images .workspace__main-images-toolbar .workspace__main-images-toolbar-settings form input[type=file]').onchange = function () {
let image,
data = new FormData();
image = this.files[0];
data.append('image',image);
$.ajax({
type: "POST",
url: "./admin.php",
contentType: false,
processData:false,
data: data,
});
}
if(isset($_FILES['image'])) {
copy($_FILES['image']['tmp_name'], '../img/' . '13124' . '.PNG');
}
el.querySelector('.workspace__main-images .workspace__main-images-toolbar .workspace__main-images-toolbar-settings form input[type=file]').onchange = function () {
let image,
data = new FormData();
image = this.files[0];
data.append('image',image);
$.ajax({
type: "POST",
url: "./admin.php",
contentType: false,
processData:false,
data: data,
});
}
if(isset($_FILES['image'])) {
copy($_FILES['image']['tmp_name'], '../img/' . '13124' . '.PNG');
}
document.querySelectorAll('.project').forEach(function (el,index) {
el.querySelector('.workspace__main-images .workspace__main-images-toolbar .workspace__main-images-toolbar-settings form').onchange = function () {
let data = new FormData,
filesField = this.value.find('input[type="file"]'),
fileName = filesField.attr('name'),
file = filesField.prop('files')[0];
data.append(fileName, file);
console.log(data);
}
});
onchange