login  Naam:   Wachtwoord: 
Registreer je!
 Forum

warning: move_uploaded_file

Offline gioske - 24/01/2006 12:16
Avatar van gioskeNieuw lid Hey,

Ik ben bezig met mjin eigen fotoalbum te schrijven maar als ik een foto wil uploaden krijg ik deze foutmelding
  1. Warning: move_uploaded_file(): Unable to move '/tmp/phpnbwD5r' to 'fotoalbum/img/7576_1138100677.jpg' in /home/gios/public_html/paul/foto/toevoegen1.php on line 52



Dit is de code van mijn pagina
  1. <?
  2. include "../connect.php" ;
  3.  
  4. $forms = 10; //Standaard aantal file uploads
  5. $status = "nieuw" ; // de status van de foto
  6. $user = TRUE; //User kan aangeven dat hij meer files wil uploaden
  7. $max_size = 0; //Maximale bestands grootte, 0 voor ongelimiteerd
  8. $max_thumb = 100; //Maximale hoogte dan wel breedte van de thumb.
  9. $ext = "jpg jpeg gif png"; // Welke extensies kunnen er worden geupload ( als alles mag dan niks invullen )
  10.  
  11. // Toegestaande extensies opvragen
  12. $ext = strtolower($ext);
  13. $ext = explode(" ", $ext);
  14. $aantal = count($ext);
  15.  
  16. if(isset($_POST['forms']) && $user==TRUE){
  17. $forms=$_POST['forms'];
  18. }
  19.  
  20. if($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST['submit'])){
  21. $aantal=count($_FILES['image']['type']);
  22. $i=0;
  23. for($i=0;$i<$aantal;$i++){
  24. $foto_name= rand(1,9999)."_".time();
  25. if(!empty($_FILES['image']['tmp_name'][$i])){
  26. $type= $_FILES['image']['type'][$i];
  27.  
  28. // Bestands naam opvragen
  29. $bestand2 = explode("\\", $_FILES['image']['name'][$i]);
  30. $laatste = count($bestand2) - 1;
  31. $bestand2 = "$bestand2[$laatste]";
  32.  
  33. // Extensie van bestand opvragen
  34. $bestand3 = explode(".", $bestand2);
  35. $laatste = count($bestand3) - 1;
  36. $bestand3 = "$bestand3[$laatste]";
  37. $bestand3 = strtolower($bestand3);
  38.  
  39. for ($tel = 0;$tel < $aantal; $tel++){
  40. if ($bestand3 == $ext[$tel]){
  41. $extfout = "nee";
  42.  
  43. }
  44. }
  45.  
  46. if($type == "image/gif" OR $type == "image/pjpeg" OR $type == "image/x-png" OR $type == "image/jpeg"){
  47. if(!empty($max_size) && $_FILES['image']['size'][$i] > $max_size){
  48. echo"Bestand is te groot: ".$_FILES['image']['size'][$i]." / ".$max_size."<br>\n";
  49. }elseif(!isset($extfout)){
  50. }else{
  51.  
  52. if(move_uploaded_file($_FILES['image']['tmp_name'][$i], "fotoalbum/img/".$foto_name.".".$bestand3)){
  53. echo $foto_name.".".$bestand3." is succesvol geupload.<br \>\n<img src=\"fotoalbum/img/thumb/".$foto_name.".".$bestand3."\" \><br \>\n";
  54. if($type == "image/gif"){
  55. $photo = imagecreatefromgif("fotoalbum/img/".$foto_name.".".$bestand3);
  56. }elseif($type == "image/pjpeg" OR $type == "image/jpeg"){
  57. $photo = imagecreatefromjpeg ("fotoalbum/img/".$foto_name.".".$bestand3);
  58. }elseif($type == "image/x-png"){
  59. $photo = imagecreatefrompng("fotoalbum/img/".$foto_name.".".$bestand3);
  60. }
  61. $photo_dimensions_width = imagesx ($photo);
  62. $photo_dimensions_height = imagesy ($photo);
  63.  
  64. if ($photo_dimensions_width > $max_thumb OR $photo_dimensoons_height > $max_thumb) {
  65. if ($photo_dimensions_width == $photo_dimensions_height) {
  66. $thumb_dimensions_width = $max_thumb;
  67. $thumb_dimensions_height = $max_thumb;
  68. }
  69.  
  70. elseif ($photo_dimensions_width > $photo_dimensions_height) {
  71. $value = $photo_dimensions_width / $max_thumb;
  72. $thumb_dimensions_width = $max_thumb;
  73. $thumb_dimensions_height = round ($photo_dimensions_height / $value);
  74. }
  75.  
  76. else {
  77. $value = $photo_dimensions_height / $max_thumb;
  78. $thumb_dimensions_height = $max_thumb;
  79. $thumb_dimensions_width = round ($photo_dimensions_width / $value);
  80. }
  81. }
  82.  
  83. else {
  84. $thumb_dimensions_width = $photo_dimensions_width;
  85. $thumb_dimensions_height = $photo_dimensions_height;
  86. }
  87.  
  88. $create_thumb = imagecreatetruecolor ($thumb_dimensions_width, $thumb_dimensions_height);
  89. imagecopyresampled ($create_thumb, $photo, 0, 0, 0, 0, $thumb_dimensions_width, $thumb_dimensions_height, $photo_dimensions_width, $photo_dimensions_height);
  90. ImageJpeg($create_thumb,'fotoalbum/img/thumb/'.$foto_name.".jpg",90);
  91. Imagedestroy($photo);
  92.  
  93.  
  94. $categorie = $_POST['categorie'] ;
  95.  
  96. $query = "INSERT INTO images (image_path,categorie)
  97. VALUES ('$foto_name','$categorie')";
  98.  
  99. mysql_query($query) or die (mysql_error());
  100.  
  101. echo "Foto's zijn succesvol ge-upload<br>" ;
  102.  
  103. }else{
  104. echo $_FILES['image']['name'][$i]." kon niet geupload worden.<br \>\n";
  105. }
  106. }
  107. }else{
  108. echo "Ongeldig type: ".$type."<br>\n";
  109. }
  110. }else{
  111. echo "Geen file geselecteerd.<br>\n";
  112. }
  113. }
  114.  
  115. }else{
  116.  
  117. ?>
  118. <FORM NAME="upload_form" METHOD="POST" ACTION="" ENCTYPE="multipart/form-data">
  119. <?
  120. for($i=0;$i<$forms;$i++){
  121. ?>
  122. <INPUT TYPE="file" value="" NAME="image[<?=$i?>]" \><br>
  123. Selecteer de categorie voor de foto :
  124. <select name="categorie">
  125. <?php
  126. $query = "SELECT * FROM categorie ORDER BY id DESC";
  127. $sql = mysql_query($query);
  128. while($record = mysql_fetch_object($sql)){
  129. echo"<option value=\"".$record->categorie."\">".$record->categorie."</option>";
  130. }
  131. ?>
  132. </select>
  133. <br \>
  134. <br>
  135. <hr>
  136. <?
  137. }
  138. ?>
  139. <INPUT TYPE="submit" NAME="submit" VALUE="Upload">
  140. </FORM>
  141. <?
  142. }
  143. ?>


alvast bedankt,

1 antwoord

Gesponsorde links
Offline Thomas - 24/01/2006 12:26
Avatar van Thomas Moderator Heeft de doeldirectory de goede lees- en schrijf-rechten?
Gesponsorde links
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.227s