[php] bestanden kopieeren op windows

Pagina: 1
Acties:

  • _.Luke._
  • Registratie: September 2001
  • Laatst online: 26-07-2021
k draai Apache en PHP op mijn winXP bak maar wanneer ik het volgende script uitvoer:

PHP:
1
2
3
4
5
6
7
8
9
10
11
12
    $sql="kweerie";
    $resultaat=mysql_query($sql);
    $New_Inserted_ID = mysql_insert_id();

    if($userfile != "")
    {
            mkdir($New_Inserted_ID,0777);
            $Slash = "\\";
            $New_Path = "d:\\Web\\Docs\\Base\\".$New_Inserted_ID.$Slash.$userfile;
            echo $New_Path;
            copy($userfile,$New_Path);
    }

maakt ie een mooi mappie aan zoals ik wil maar op het moment dat het bestand gekopieerd moet worden krijg ik de melding:

d:\Web\Docs\Base\2\C:\WINDOWS\php15.tmp
Warning: Unable to create 'd:\Web\Docs\Base\2\C:\WINDOWS\php15.tmp': Invalid argument in d:\web\docs\base\add_item_save.php on line 36

enne line 36 is dus het copy statement...

Hoe kan dat... heb al van alles geprobeerd met die mappenstructuur maar kom er niet helemaal uit...

Trying is the first step towards faillure...


  • Janoz
  • Registratie: Oktober 2000
  • Laatst online: 28-08 12:00

Janoz

Moderator Devschuur®

!litemod

Druk $userfile maar eens appart af. Ik denk dat je je probleem dan wel ziet... Voor de oplossing moet je vervolgens ff in de php_manual kijken om te zien wat voor mogelijke vars je allemala tot je beschikkiung hebt bij een file upload...

Ken Thompson's famous line from V6 UNIX is equaly applicable to this post:
'You are not expected to understand this'


  • PrinsEdje80
  • Registratie: Oktober 2001
  • Laatst online: 01-01 15:26

PrinsEdje80

Holographic, not grated...

_.Luke._ schreef op 10 september 2002 @ 10:18:
PHP:
1
2
3
4
            $New_Path = "d:\\Web\\Docs\\Base\\".$New_Inserted_ID.$Slash.$userfile;
            echo $New_Path;
            copy($userfile,$New_Path);
    }

d:\Web\Docs\Base\2\C:\WINDOWS\php15.tmp
Warning: Unable to create 'd:\Web\Docs\Base\2\C:\WINDOWS\php15.tmp': Invalid argument in d:\web\docs\base\add_item_save.php on line 36
Je plakt niet de bestandsnaam achter je nieuwe locatie, maar de hele path waar deze file eerst stond. Kun je oplossen door te zorgen dat je alles voor en incl. de laatste backslash wegript van $userfile. (In c++ een fie: findlastof..., maar dit is php ;))

Used to be Down Under... Foto gallery


  • _.Luke._
  • Registratie: September 2001
  • Laatst online: 26-07-2021
?? kom je zeker aan de regexp :(:( maar hij (het bestand) moet in de nieuw aangemaakte dir komen te staan... werkt dat dan op die manier ook nog?

Trying is the first step towards faillure...


  • Janoz
  • Registratie: Oktober 2000
  • Laatst online: 28-08 12:00

Janoz

Moderator Devschuur®

!litemod

Wat zeg ik nou RTFM en zoek het verschil tussen $userfile en $userfile_name!

Ken Thompson's famous line from V6 UNIX is equaly applicable to this post:
'You are not expected to understand this'


  • _.Luke._
  • Registratie: September 2001
  • Laatst online: 26-07-2021
Sorry... wist niet dat domme vragen bestonden...

Ben er in ieder geval uit... senks voor de hulp!!!

Trying is the first step towards faillure...

Pagina: 1