credential window of shared folder
without manually entering the credentials i want to access the shared folder from my php code
<?php
$user = 'lol';
$password = 'noob'
$upload_dir = "\\192.168.1.2\uploaded_files\"; //this only works if i manually enter username and password for the shared folder
$allowed_types = array('jpg', 'png', 'jpeg', 'gif');
// Define maxsize for files i.e 2MB
$maxsize = 2 * 1024 * 1024;
// Checks if user sent an empty form
if(!empty(array_filter($_FILES['uploadedFile']['name']))) {
// Loop through each file in files[] array
foreach ($_FILES['uploadedFile']['tmp_name'] as $key => $value) {
$file_tmpname = $_FILES['uploadedFile']['tmp_name'][$key];
$file_name = $_FILES['uploadedFile']['name'][$key];
$file_size = $_FILES['uploadedFile']['size'][$key];
$file_ext = pathinfo($file_name, PATHINFO_EXTENSION);
// Set upload file path
$filepath = $upload_dir.$file_name;
?>
// this code is seems to work for some users but in my case it doesn’t
exec(‘net use “\192.168.1.2uploaded_files” /user:”‘.$user.'” “‘.$password.'” /persistent:no’);