Очень надо за сегодня эту задачу решить.
Директории все создаются. Никакие проблем при использование copy()
Из админки файлы загружаются. Я так понимаю, что что-то я не доглядел. Люди, помогите!
Мой код ниже. Все переменные верные. Если нужно вывод чего-то для анализа, могу скинуть.
Пишит мне:
Ошибка создания и записи в файл /upload/information_system_27/1/9/6/item_196/nissan_presea_g495.jpg
Ошибка создания и записи в файл /upload/information_system_27/1/9/6/item_196/small_nissan_presea_g495.jpg
Ошибка создания и записи в файл /upload/information_system_27/1/9/6/item_196/nissan_terrano_g450.jpg
Ошибка создания и записи в файл /upload/information_system_27/1/9/6/item_196/small_nissan_terrano_g450.jpg
Ошибка создания и записи в файл /upload/information_system_27/1/9/6/item_196/nissan_presage_g491.jpg
Ошибка создания и записи в файл /upload/information_system_27/1/9/6/item_196/small_nissan_presage_g491.jpg
if(isset($_FILES) and !$flag){
$Image = new Image();
$jpeg_quality = JPG_QUALITY;
$information_propertys_items_id = 0;
$information_items_id = $iid;
$iItemDir = '/'.$InformationSystem->GetInformationItemDir($iid);
$type = 0;
foreach($_FILES as $id=>$file){
if($file['error'] == 0){
unset($param);
$param=array();
$information_propertys_id= $id;
$information_propertys_items_value = $iItemDir.$file['name'];
$information_propertys_items_file = $file['name'];
$information_propertys_items_value_small = $iItemDir.'small_'.$file['name'];
$information_propertys_items_file_small = 'small_'.$file['name'];
$path_array = explode("/", $iItemDir);
$count = count($path_array)-1;
$temp_path = false;
//////////Написал это, потому что директории не сохдавалить в upload
for( $i = 0; $i < $count; $i++){
$temp_path.= $path_array[$i].'/';
$temp = $temp_path;
if(!file_exists(substr(CMS_FOLDER,0,-1).$temp))
mkdir(substr(CMS_FOLDER,0,-1).$temp, 0777);
}
$source_file = $file['tmp_name'];
$target_file = $iItemDir.$file['name'];
$max_width = 800;
$max_height = 800;
$Image->ResizeToFileEx($source_file, $max_width, $max_height, $target_file, $jpeg_quality);
$max_width = MAX_IMAGE_PROPERTY_SHOP;
$max_height = MAX_IMAGE_PROPERTY_SHOP;
$source_file = $iItemDir.$file['name'];
$target_file = $iItemDir.'small_'.$file['name'];
if($Image->ResizeToFileEx($source_file, $max_width, $max_height, $target_file, $jpeg_quality)){
$InformationSystem->InsertInformationPropertysItems($type, $information_propertys_items_id, $information_propertys_id, $information_items_id, $information_propertys_items_value);
}
}
}
}
Пример массива $_FILES
Array
(
[17] => Array
(
[name] => nissan_presea_g495.jpg
[type] => image/jpeg
[tmp_name] => /tmp/phpcef07x
[error] => 0
[size] => 6198
)
[18] => Array
(
[name] => nissan_terrano_g450.jpg
[type] => image/jpeg
[tmp_name] => /tmp/phpzIBuv9
[error] => 0
[size] => 5304
)
[19] => Array
(
[name] => nissan_presage_g491.jpg
[type] => image/jpeg
[tmp_name] => /tmp/phpszQ3SK
[error] => 0
[size] => 4452
)
[20] => Array
(
[name] =>
[type] =>
[tmp_name] =>
[error] => 4
[size] => 0
)
[21] => Array
(
[name] =>
[type] =>
[tmp_name] =>
[error] => 4
[size] => 0
)
)