Try this
upload.php
--------
<?
/* Max filesize: */
if($arquivo_size > 1024000) {
print "<SCRIPT> alert('File cannot to be larger than 1 Mb');
window.history.go(-1); </SCRIPT>\n";
exit;
}
/* Define target dir to store uploaded files */
if (!empty($arquivo) and is_file($arquivo)) {
$caminho="/full/path/to/the/dir/";
$caminho=$caminho.$arquivo_name;
/* Define the kind of file allowed */
if ((eregi(".DOC$", $arquivo_name)) || (eregi(".zip$",
$arquivo_name))){
copy($arquivo,$caminho);
print "<h1><center>File was sent!</center></h1>";
}
else{
print "<h1><center>File was not sent!</center></h1>";
print "<h2><font color='#FF0000'><center>File type not
allowed!</center></font></h2>";
}
}
?>
--------
upload.html
<html>
<head>
<script language="JavaScript">
<!--
function teste(){
if (document.upload.arquivo.value=="") {
alert("Arquivo para upload não informado!")
document.upload.arquivo.focus()
return false
}
}
//-->
</script>
</head>
<body>
<h2>Upload Simples</h2><br>
<form name="upload" action="upload.php" method="post"
enctype="multipart/form-data" onsubmit="return teste()">
<input type="file" name="arquivo" size="60"><br>
<br>
<input type="submit" name="enviar" value="Upload!">
</form>
</center>
</body>
</html>
=============
[]
Carlos
ti***@ziplip.com (Tihon) wrote in message news:<7d**************************@posting.google. com>...
Hello!
I again need your help, just can't understand whats going on.
Got this upload pictures form and it's having problem handling large
files (~1.5 - 2 MB).
Everything works fine if i just upload files, like this:
copy ($myfile, $uploadfolder . "/" . $myfile_name);
Everything works fine, it can process large files and everything,
but i need to make sure that people only upload pictures, so i change
it to this:
$fext = strrchr($myfile_name,".");
if($fext==".jpg" || $fext==".jpeg")
{
copy ($myfile, $uploadfolder . "/" . $myfile_name);
}
After this modification it can only process relatively small files,
around 200-300 kb, everytime i try to upload a large file it just does
not do anything,
it looks like the file is being uploaded and then nothing, the file is
not there...
I tried setting
set_time_limit(0);
but it did not change anything...
if i check the extension it does not upload large files, if i don't -
it does...
Could someone help me please, thank you!
P.S. Whats better to use, copy or move_uploaded_file? Or it just does
not matter?
Thanks a lot again!