Jump to content
php.lv forumi

Vienkārši bet nesaprotāmi


marnix

Recommended Posts

Man ir kods faila uploudošanai tik man viņš nestrādā.....

Es esmu pārāk zaļš tādēļ es nezinu kas tur jālabo?????

Varbūt kāds var pateikt kas par vainu..

 

<!-- The data encoding type, enctype, MUST be specified as below -->
<form enctype="multipart/form-data" action="pictures/generate.php" method="POST">
<!-- MAX_FILE_SIZE must precede the file input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<!-- Name of input element determines name in $_FILES array -->
Send this file: <input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>

Link to comment
Share on other sites

tas man ir bet tomēr man kautkas neiet..

 

 

<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.

$uploaddir = 'pict/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
  echo "File is valid, and was successfully uploaded.\n";
} else {
  echo "Possible file upload attack!\n";
}

echo 'Here is some more debugging info:';
print_r($_FILES);

print "</pre>";

?>

Link to comment
Share on other sites

Es nezinu kas par kļūdu..

 

viņš man met ārā tādu erroru..

 

 

Possible file upload attack!

Here is some more debugging info:Array

(

[userfile] => Array

(

[name] => IMGP8393.JPG

[type] =>

[tmp_name] =>

[error] => 2

=> 0

)

 

)

Link to comment
Share on other sites

aa vēl viena lieta .. esmu sameistarojis kautkādu skriptu un man tagad vinš met ārā kautkādu stulbu erroru... man nau ne jausmas ko tajā rindā izdarīt

 

Warning: Invalid argument supplied for foreach() in c:\web\easyphp1-8\www\generate.php on line 15

 

15 rinda ir iekrāsota....

 

<?
$name = $_POST['Naktsmitnes_veids'];
$text = $_POST['Nosaukums'];
$file=fopen($text.".html", 'w+');
fputs($file,"<h3><strong>$name '$text'</strong></h3><br> <img src='icons/$name.gif' alt='$name'>");
fclose($file);
?>
<?
$links = ("$name,links");
$file=fopen($links.".html",'a');
fputs($file,"<a href='$text.html'>$name '$text'</a><br>");
fclose($file);
?>
<?php
foreach ($_FILES["pictures"]["error"] as $key => $error) {
  if ($error == UPLOAD_ERR_OK) {
      $tmp_name = $_FILES["pictures"]["tmp_name"][$key];
      $name = $_FILES["pictures"]["name"][$key];
      move_uploaded_file($tmp_name, "$name");
  }
}
?>

Edited by marnix
Link to comment
Share on other sites

jā šito skriptu es no turienes ņēmu.. šitais ir vienīgas no visiem kas man der ...kā jau iepriekš teicu kad es nezinu kas par kļūdu šajā skriptā....es cerētu uzzināt kāda tur kļūda īsti ir... Paldies par pūlēm :D

Edited by marnix
Link to comment
Share on other sites

×
×
  • Create New...