Re: Upload files
| From: | Juan Pablo Aqueveque | Date: | Thu, 22 Aug 2002 19:44:03 +0000 |
| Subject: | Re: Upload files | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-113703@lists.php.net to get a copy of this message | ||
Here's is again if you Email client interpret HTML code:
<?php
$uploadDir = '.fotos/';
if (isset($submit)){
if ($upload != 'none'){
$dest = $uploadDir . $upload_name;
if (@copy($upload, $dest)){
echo "Successfully uploaded $dest<BR>\n";
}
else{
echo "<FONT COLOR=FF0000><B>File Upload Failed</B></FONT><BR>\n";
$perms = @fileperms($uploadDir);
$owner = @fileowner($uploadDir);
if (!$perms){
echo "Directory does not exist: $uploadDir<BR>\n";
}
else{
$myuid = getmyuid();
if (!($perms & 2) && !(($owner == $myuid) && ($perms & 128))){
echo get_current_user(), " doesn't have permission to write in $uploadDir<BR>\n";
}
}
}
}
else{
echo "<FONT COLOR=FF0000><B>File Upload Failed</B></FONT><BR>\n";
echo "Filesize exceeds limit in FORM or php.ini<BR>\n";
}
}
?>
the form
<FORM ENCTYPE=multipart/form-data ACTION="upload.php" METHOD=POST>
<INPUT TYPE=HIDDEN NAME=MAX_FILE_SIZE VALUE=10000>
Upload File: <INPUT NAME=upload TYPE=FILE><BR>
<INPUT TYPE=SUBMIT NAME=submit VALUE="Upload">
</FORM>
--jp
At 19:34 22-08-2002 -0600, you wrote:
Whats the code in upload.php? Also, is upload.php also the file with the <form> tag or is this a seperate html/php file? Please post the rest of your php code so someone can better help you and find any possible problems.. Take care.. peace.. eriol ==== "Juan Pablo Aqueveque" <juque@uct.cl> disgorged: : I can't upload files? : : <FORM ENCTYPE=multipart/form-data ACTION=upload.php METHOD=POST> : : my php.ini file_uploads = On : : PHP Version 4.1.2/Apache________________________________________________________ Juan Pablo Aqueveque <juque@uct.cl> Ingeniero de Sistemas Departamento de Redes y Comunicaciones http://www.drc.uct.cl Universidad Católica de Temuco. Tel:(5645) 205 630 Fax:(5645) 205 628