Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

<? $updir = "/pictures/"; $good

Status
Not open for further replies.

kusarigama

Technical User
Apr 24, 2002
45
DE
Hi all,

I've a problem with the following. When I hit the upload button I get a error message from the script which says:
UNABLE TO CREATE '/pictures/': Is a directory ...

this directory already exists - I didn't tell the script that it should create a directory ...

Here is the code:

HTML STUFF ...
<form name=&quot;uploader&quot; method=&quot;post&quot; action=&quot;<?print($PHP_SELF);?>&quot; enctype=&quot;multipart/form-data&quot;>

<?
$updir = &quot;/pictures/&quot;;
$good = &quot;<font face=verdana size=2 color=green><b>History/Turniere wurde aktualisiert !</b></font>&quot;;
$bad = &quot;<font face=verdana size=2 color=red><b>Upload Fehler !</b></font>&quot;;
$empty = &quot;<font face=verdana size=2 color=red><b> Wählen Sie eine Datei aus :)</b></font>&quot;;

if(isset($upload)) // name of submit button
{
$checker = copy($_FILES['userfile']['tmp_name'],$updir);
print $checker ? $good : $bad;
if(empty($_FILES['userfile']['name']))
{
print $empty;
}
}

?>
HTML STUFF
<input type=&quot;file&quot; name=&quot;userfile&quot;>


Thanx in advance
Olli
 
You are copying the file to a directory name not into the directory .
--------------------
// possibly when specifying directories you need a leading .
$updir = &quot;./pictures/&quot;;
// now we copy the file into $updir and call it its original name
if(isset($upload)) // name of submit button
{
$checker = copy($_FILES['userfile']['tmp_name'],$updir.$userfilename);
print $checker ? $good : $bad;
if(empty($_FILES['userfile']['name']))
{
print $empty;
}
} ______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Hi,

this is still not working. I tried to put the whole pass in but in vain ...

$updir = &quot;$good = &quot;<font face=verdana size=2 color=green><b>History/Turniere wurde aktualisiert !</b></font>&quot;;
$bad = &quot;<font face=verdana size=2 color=red><b>Upload Fehler !</b></font>&quot;;
$empty = &quot;<font face=verdana size=2 color=red><b> Wählen Sie eine Datei aus :)</b></font>&quot;;

if(isset($update))
{
$checker = copy($_FILES['userfile']['tmp_name'],$updir.$userfilename);
print $checker ? $good : $bad;
if(empty($_FILES['userfile']['name']))
{
print $empty;
}
}
 
ok to see if the upload works at all, leave out the directory.
$checker = copy($_FILES['userfile']['tmp_name'],$userfilename);


and se if you end up with a new file on the server, if not something more serious is awry. ______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
It works now :) It was a mistake of mine ...

$checker = copy($_FILES['userfile']['tmp_name'],$_FILES['userfile']['name']);

Thanx after all ;9

Olli
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top