Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> move_uploaded_file błąd
istrd
post
Post #1





Grupa: Zarejestrowani
Postów: 90
Pomógł: 0
Dołączył: 3.12.2009

Ostrzeżenie: (0%)
-----


Witam.
Mam taki problem mam upload obrazków ale wyświetla mi błędy. Nie wiem co jest źle bo wczesniej działało a po zaistalowaniu biblioteki GD już nie działa ! szukam w necie i nic nie pomaga !

  1. Warning: move_uploaded_file() [function.move-uploaded-file]: The second argument to copy() function cannot be a directory in /var/www/dodaj.php on line 71
  2.  
  3. Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpL4xQWK' to 'obraz/' in /var/www/dodaj.php on line 71



  1. <?php
  2.  
  3. {
  4.  
  5.  
  6. $name=$_SESSION['name'];
  7.  
  8.  
  9. echo'<!-- pocztek tabelki z newsami --><table align="center" CELLPADDING=0 CELLSPACING=0>
  10. <tr>
  11. <td class="topn"></td>
  12. </tr>
  13. <td class="tlon">
  14. <div class="news">';
  15.  
  16. <form enctype="multipart/form-data" method="POST">
  17. <input type="text" name="tytul"><b> Podaj tytul<b/> <font color="red"> Pole wymagane</font><br />
  18. <input type="text" name="podpis"><b> Podaj podpis<b/> <font color="red"> Pole wymagane</font><br />
  19. <input type="text" name="zrodlo"><b> Podaj zrodlo<b/> <font color="red"> Pole wymagane</font><br />
  20. <input type="text" name="tagi"><b> Podaj tagi<b/> <font color="white"> Pole nie wymagane</font><br />
  21. <input type="hidden" name="MAX_FILE_SIZE" value="50000" />
  22. <input name="plik" type="file" />
  23. <input type="submit" name="submit" value="submit" />
  24. </form>
  25. ';
  26.  
  27. if(is_file($_FILES['plik']['tmp_name']))
  28. {
  29. $u_plik = $_FILES['plik']['tmp_name'];
  30. $u_nazwa = $_FILES['plik']['name'];
  31. $u_rozmiar = $_FILES['plik']['size'];
  32. $u_typ=$_FILES['plik']['type'];
  33. $log=$_SESSION['user'];
  34. polacz();
  35.  
  36. $ssij=mysql_query("SELECT id FROM newsy ORDER BY id DESC LIMIT 1");
  37. if(mysql_num_rows($ssij)>0)
  38. {
  39. while($y=mysql_fetch_assoc($ssij))
  40. {
  41. //echo'<b>'.$y['id'].' </b></br>';
  42. $d=$y['id'];
  43. $d++;
  44. }
  45.  
  46. }
  47. else
  48. {
  49. $d=1;
  50. }
  51.  
  52. $nazwa='demot'.$d.'_'.$u_nazwa;
  53. $nazwa=$pic;
  54.  
  55.  
  56. if(is_uploaded_file($u_plik))
  57. {
  58.  
  59.  
  60. $tab[]='image/gif';
  61. $tab[]='image/jpg';
  62. $tab[]='image/png';
  63. $tab[]='image/jpeg';
  64. $tab[]='image/JPEG';
  65. if(array_search($u_typ,$tab)!==false)
  66. {
  67.  
  68. $kat="obraz/";
  69. move_uploaded_file($u_plik,$kat.$nazwa);
  70. list($width, $height, $type, $attr) = getimagesize("obraz/$nazwa");
  71. if(($width>1024) or ($height>725))
  72. {
  73. echo "Wysokośc lub szerokośc obrazka jest za duża maksymalna rozdzielczośc obrazka to 240x320 !<br>";
  74. unlink("demoty/$nazwa");
  75.  
  76. }
  77. else
  78. {
  79.  
  80. echo'plik uploadowany<br>';
  81.  
  82. }
  83.  
  84.  
  85. }
  86. else
  87. {
  88. echo"Format pliku jest nie prawidłowy.<br> ";
  89.  
  90. }
  91.  
  92.  
  93. }
  94. }
  95.  
  96.  
  97.  
  98.  
  99. if(isset($_POST["submit"]))
  100. {
  101. if(empty($_POST["tytul"]) or empty($_POST["podpis"]) or empty($_POST["zrodlo"]))
  102. {
  103. echo"Podaj Wszystkie wymagane dane";
  104. }
  105. else
  106. {
  107. $tytul=$_POST['tytul'];
  108. $podpis=($_POST['podpis']);
  109. $zrodlo=$_POST['zrodlo'];
  110. $tagi=$_POST['tagi'];
  111. $akcept=false;
  112. $data=date("Y-m-d");
  113. if(session_is_registered("admin"))
  114. {
  115.  
  116. $autor=$_SESSION["jaki"];
  117. }
  118. else
  119. {
  120. $autor=$_SESSION['name'];
  121.  
  122. }
  123.  
  124. polacz();
  125. $mocne=0;
  126. $slabe=0;
  127. $wysylamy="INSERT INTO `newsy` VALUES ('".$id."','".$tytul."','".$podpis."','".$data."','".$autor."','".$zrodlo."',NOW(),'".$akcept."','".$tagi."','".$pic."','".$mocne."','".$slabe."')";
  128. $wys=mysql_query($wysylamy)or die ("coś nie tak ".mysql_error());
  129. if($wys)echo'dodano';
  130. else echo'Error';
  131.  
  132.  
  133.  
  134. }
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146. }
  147.  
  148.  
  149. echo'</div></td>
  150. <tr>
  151. <td class="doln"></td>
  152. </tr>
  153. </table> <!-- koniec tabeli z newsami -->
  154. ';
  155.  
  156.  
  157.  
  158. }
  159. else
  160. {
  161.  
  162. header("location:index.php");
  163.  
  164. }
  165.  
  166.  
  167.  
  168. ?>
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 24.08.2025 - 17:00