Ok - so I'm not a great coder either...still a newbie myself but there are a few things to check.
First -- check your form...
you should have enctype="multipart/form-data" and MAX_FILE_SIZE in there like this...
<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="<!--your max value in bytes-->" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
Second -- check your php.ini
Usually in the php.ini, there is a 2mb limit (i think?) and you'll have to up this before uploading larger files.
Third -- check your code
You can echo out your variables to see what is happening and where the hang up is...
Example...
//did you post your file to a variable on this page?
//did you use the long tag to open php???
$result = 0;
$target_path = "images/".$rd."_".$_FILES['foto_img']['name'];
if(move_uploaded_file($_FILES['foto_img']['tmp_name'], $target_path))
{
$result = 1;
}
if($result > 0)
{
echo"
upload successful. <br>
target_path: $target_path
";
}else{
echo"
upload failed. <br>
target_path: $target_path
";
}
Also -- don't forget to check your file permissions on the file your trying to upload to. Try 777 for debugging to be sure file permissions aren't your problem.
I don't know that I'm totally accurate, but phpbuilder helped me a lot.
If that doesn't work - post your complete code and I'll check back.
5 mb is a large file -- it may take a minute or two to upload.
btw - lots of security problems with a simple uploader like that - no checking of file types or even extensions -- maybe you did that earlier in the code???