I have found a solution like that:
First installed a plugin called “Add Shortcodes Actions And Filters” and then created action containing below code:
function cfdbFilterSaveFiles($formData) {
// CHANGE THIS: CF7 form name you want to manipulate
$formName = ‘krediiii’;
$current_user = wp_get_current_user();
$klasoradi = $current_user->user_login;
if (!file_exists(‘fal_resimleri/’.$klasoradi)) {
mkdir(‘fal_resimleri/’.$klasoradi, 0777, true);
}
if ($formData && $formName == $formData->title) {
// CHANGE THIS: directory where the file will be saved permanently
$uploadDir = ‘../public_html/fal_resimleri/’. $current_user->user_login.’/’;
// CHANGE THIS: URL to the above directory
$urlDir = ‘www.astroenerji.com/fal_resimleri/’. $current_user->user_login.’/’;
// CHANGE THIS: upload field names on your form
$fieldNames = array(‘Resim-1’, ‘Resim-2’, ‘Resim-3’, ‘Resim-4’, ‘Resim-5’);
return saveFilesInForm($formData, $uploadDir, $urlDir, $fieldNames);
}
return $formData;
}
add_filter(‘cfdb_form_data’, ‘cfdbFilterSaveFiles’);
function saveFilesInForm($formData, $uploadDir, $urlDir, $fieldNames) {
// make a copy of data from cf7
$formCopy = clone $formData;
foreach ($fieldNames as $fieldName) {
if (isset($formData->uploaded_files[$fieldName])) {
// breakdown parts of uploaded file, to get basename
$path = pathinfo($formCopy->uploaded_files[$fieldName]);
// directory of the new file
$newfile = $uploadDir . time().$path[‘basename’];
// check if a file with the same name exists in the directory
if (file_exists($newfile)) {
$dupname = true;
$i = 2;
while ($dupname) {
$newpath = pathinfo($newfile);
$newfile = $uploadDir . $newpath[‘filename’] . ‘-‘ . $i . ‘.’ . $newpath[‘extension’];
if (file_exists($newfile)) {
$i++;
} else {
$dupname = false;
}
}
}
// make a copy of file to new directory
copy($formCopy->uploaded_files[$fieldName], $newfile);
// save the path to the copied file to the cfdb database
$formCopy->posted_data[$fieldName] = time().$path[‘basename’];
// delete the original file from $formCopy
unset($formCopy->uploaded_files[$fieldName]);
}
}
return $formCopy;
}
add_filter(‘cfdb_form_data’, ‘cfdbFilterSaveFiles’);
then I wrote the below code under the cfdb shortcode where I want to show the output:
<?php
$current_user = wp_get_current_user();
?>
<script type=”text/javascript”>
(function ($) {
$(‘td[title=”Resim-1″] div’).each(
function () {
$(this).html(‘user_login; ?>/’ + $(this).html() + ‘”>Foto?raf-1‘);
})
})(jQuery);
</script>