Upload wont work, OS X

From: Date: Fri, 29 Nov 2002 14:57:18 +0000
Subject: Upload wont work, OS X
Groups: php.general 
Request: Send a blank email to php-general+get-126474@lists.php.net to get a copy of this message
I have trouble using upload scripts - none of them work on my current config. I'vq got php 4.2.3 and global registerd = off. The problem is that the script doesnt send the variable $_FILES['my_file'] as it should. I can only upload if i hard code the filename into the script. OS: OS X 10.2 PHP: PHP 4.2.3 MYSQL: 3.23.51 // the script i've tried, it works with older versions av php. <?php // Programmerer: Kim aka astrox // Mail: kim@htmlhjelp.no // Dato: 19.04.2002 // Hjemmeisde: www.htmlhjelp.no ?> <h3>Bilde upload</h3> Dette scriptet uploader bilder og bare bilder!<br> Dvs.. *.jpg, *.gif og *.png<br><br> <?php #Config $MAX_FILE_SIZE = $_POST['MAX_FILE_SIZE']; $bilde_fil = $_FILES['bilde_fil']; // HTTP_POST_FILES $nyttnavn = $_POST['nyttnavn']; $ending = $_POST['ending']; $Upload = $_POST['Upload']; echo is_array($HTTP_POST_FILES['bilde_fil']); print_r($bilde_fil); print $bilde_fil; $path="upload"; //Mappa som bildene skal havne i (husk den siste '/') #Ikke rediger under her hvis du ikke vet hva du driver med :) if ($bilde_fil && $nyttnavn){ $ok = 1; if (is_file($path.$nyttnavn.$ending)){
      print "<b>Sorry</b>, fila eksisterer allerede, finn p et nytt navn.<br>";
      $ok = 0;
} if (preg_match("/^[\/\\\.]/", $nyttnavn)){
      print "<b>Sorry</b>, filnavnet kan ikke begynne ned: '.', '/' eller '\'<br>";
      $ok = 0;
} if (!($ending == ".jpg" || $ending == ".gif" || $ending == ".png")){
      print "<b>Sorry</b>, ingen triksing med filendingen ($ending) takk!<br>";
      $ok = 0;
} print "<br>"; } if ($ok){ $res = copy($bilde_fil, $path."/".$nyttnavn.$ending); print ($res)?"<b>Ferdig</b>, uploadet ".$nyttnavn.$ending."!<br>":"<b>Sorry</b>, Kunne ikke uploade.<br>"; print "<br>"; } ?> <form name="formen" action="upload.php" method="post" enctype="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="1000000"> Bilde: <input type="file" name="bilde_fil"><br> Hva skal fila hete p servern: <input type="text" name="nyttnavn"> <select name="ending"> <option>.jpg</option> <option>.png</option> <option>.gif</option> </select> <br><br><input type="submit" value="Upload"> </form>

« previous php.general (#126474) next »