By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,946 Members | 712 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,946 IT Pros & Developers. It's quick & easy.

Error uploading files

P: 60
[PHP]<?
if(empty($_POST)){ ?>
<html>
<body>
<form method="POST" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="10240000">
Archivo: <input type="file" name="arch"><br><br>
<center><input type="submit" value="Subir Archivo"></center>
</form>
</body>
</html> <?

}else{
$rn = $_FILE['arch']['name'];
$tn = $_FILE['arch']['tmp_name'];

if(is_uploaded_file($tn)){
if(move_uploaded_file($tn, $rn)){
echo "Archivo "."<b>".$rn."</b>"." subido";
unlink($tn);
}else{
echo "Error al mover archivo ".$tn;
}
}else{
echo "Error al subir archivo";
}
}

?>[/PHP]

why doesn't it uploads the file i select ???

it always prints Error al "subir archivo"

in php.ini the maxsize is 32MB so that isn't the problem
May 28 '07 #1
Share this Question
Share on Google+
3 Replies


pbmods
Expert 5K+
P: 5,821
Try using:

Expand|Select|Wrap|Line Numbers
  1. print_r($_FILE);
  2.  
To make sure the file was uploaded properly. Especially pay attention to the 'error' index. You can look up the error code here.
May 28 '07 #2

P: 60
thanks, but the problem was very stupid:

$_FILE xD --> while it should be $_FILES
May 30 '07 #3

pbmods
Expert 5K+
P: 5,821
*pause*

Yes. That problem should be ashamed of itself!

Heh.

*grumble* wow HOW did I miss that one???
May 31 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.