Hi there hihidavid,
You are aware that default file size for uploading using php is 2MB I think, but you can increase it. Another alternative for larger file uploads is by using zip, or using shell commands to use an external program so that you don't give the parser a hernia ;)
Ftp client would be an easier option, but I agree with the reasoning behind your reluctance to do that. Only the webmaster should have FTP access IMO.
skoff: There are lots of file uploader scripts out there, try : [
phpclasses.org ], this is one of my preferred places to go when I need something that I can cannibalise/tweek ;)
But, honestly, doing a simple uploader script - no bells, no whistles would be a good thing to learn should you want something like this in the future (not to mention your portfolio).
Hope this helps you in some way ;)
Just to hint at something here too:-
Receiving the data (php side):-
$_FILES['yourfilename']['name'];
$_FILES['yourfilename']['tmp_name'];
$_FILES['yourfilename']['size'];
This is the $_FILES multidimensional array, use this when making an uploader script, its not a $_POST superglobal as the form is constructed like so:-
<form action="process.php" method="post"
enctype="multipart/form-data">
and the input type is declared like so (this is the one that gives you the browse button..):-
<input
type="file" name="yourfilename" />
This is the difference between a normal form with just text to a form with additional data, BUT because you can still have text fields declared, you still require the method="post" defined in the form tag, therefore you still need the $_POST sanitising when processing the data.
And to make sure that you don't get anything unwanted uploaded, you can create an array of allowed extensions, then just read everything from the '.' to see what the extension is, of course, that is only checking an extension, but at least that way, you have a degree of security when getting things uploaded to your site.
$extensions = array('.gif','.jpg','.jpeg');
$ext = strrchr(strtolower($nameToCheck), '.');//just incase it came as uppercase, you never know ;)
if (!in_array($ext, $extensions)){
echo "Filetype not valid";
}
I just thought as I should mention those points.
Cheers,
MRb