{% else-1 %}
(10 янв 2014, 21:04) (0/0) [0]
-=MTV=-, [code]
if (isset($_POST[\'get\']) && Удалён {
$getfile = filter($_POST[\'url\']);
$url = preg_replace(\'#.[^/]*$#\', NULL, $getfile);
$filename = str_replace($url.\'/\', \'\', $getfile); // полное имя файла
$data = file_get_contents($getfile);
$handle = fopen($filename, \'w\');
fwrite($handle, $data);
fclose($handle);
header(\'Location: test.php\');
} elseif (isset($_POST[\'get\']) && Удалён {
header(\'Location: test.php\');
}

include \'system/head.php\';
echo \'<form method=\"post\">
Введите полный путь к файлу:<br>
<input type=\"text\" name=\"url\" /><br>
<input type=\"submit\" name=\"get\" value=\"Загрузить\" />
</form>\';
[/code]
(10 янв 2014, 20:55) (0/0) [0]
Походу без загрузки на сервер, размер не узнать...
(10 янв 2014, 20:49) (0/0) [0]
-=MTV=-, Warning: fread() expects parameter 1 to be resource
(10 янв 2014, 20:36) (0/0) [0]
-=MTV=-, да.
(10 янв 2014, 20:34) (0/0) [0]
-=MTV=-, так я ж не через форму файл загружаю!
(10 янв 2014, 20:28) (0/0) [0]
-=MTV=-, а оно разве покажет размер файла которого нет на сервере? Ведь это импорт.
(10 янв 2014, 20:23) (0/0) [0]
Есть код:
[code]
if (isset($_POST[\'get\']) && Удалён {
$getfile = filter($_POST[\'url\']);
$path = \'files/\'; // папка для загрузки
$url = preg_replace(\'#.[^/]*$#\', NULL, $getfile);
$fullname = str_replace($url.\'/\', \'\', $getfile); // полное имя файла
$name = preg_replace(\'#.[^.]*$#\', NULL, $fullname); // имя файла без расширения
$ext = strtolower(str_replace($url.\'/\'.$name, \'\', $getfile)); // расширение файла
$newname = $path.md5(md5(rand(\'111111\', \'999999\').time())); // генерируем новое имя
$filename = $newname.$ext;
$data = file_get_contents($getfile);
$handle = fopen($filename, \'w\');
fwrite($handle, $data);
fclose($handle);
header(\'Location: test.php\');
}
[/code]
Мне нужно проверить размер файла перед загрузкой, как это сделать?
  • 1 из 1