Показать сообщение отдельно

  #3  
Старый 06.05.2008, 21:57
groundhog
Познавший АНТИЧАТ
Регистрация: 12.05.2007
Сообщений: 1,235
Провел на форуме:
2238549

Репутация: 1318


Отправить сообщение для groundhog с помощью ICQ
По умолчанию

Скрипт через жопу написан. Попробуй так:

PHP код:
<?php

$html_code 
=<<<HTML_CODE
<html>
<head>
<title>Upload</title>
</head>
<body>
<form method="post" enctype="multipart/form-data">
<input name="file1" type="file" /><br />
<input type="submit" value="Upload" />
</form>
</body>
</html>
HTML_CODE;

print(
$html_code);

define("SERVER_UPLOAD_DIR""upload");

set_time_limit(0);

if (isset(
$_FILES) && is_array($_FILES)) {
   foreach (
$_FILES as $file) {
      if (
$file['error'] == 0) {
         
$destination sprintf("%s/%s"SERVER_UPLOAD_DIR$file['name']);
         if (
move_uploaded_file($file['tmp_name'], $destination))
            
printf("File '%s' with size %s Kb was successfully uploaded...<br>\n"$file['name'], round($file['size'] / 10242));
         else
            
printf("Could not move uploaded file '%s' to destination...");
      } else
         
printf("Error %s occuried. Could not upload file to server - skiping...<br>"$file['error']);
   }
}

?>
Разумеется диру из константы не забудь создать...
 
Ответить с цитированием