Forum Moderators: coopster
Form Input Code:
<form action="picpost.php" method="post" enctype="multipart/form-data" name="stage4" id="stage4">
<table width="700" border="1" align="center" cellpadding="2" cellspacing="2" bordercolor="#FFFFFF">
<tr bordercolor="#C0C0C0" bgcolor="#EEEEEE">
<td valign="top"><div align="center">
<p>
<?php
$numoffile = 1+$_POST['expics'];
for($i=0;$i<$numoffile;$i++) {
print "<input type='file' name='myfiles[]' size='30'><br>";
}
?>
</p>
<input type="submit" name="Submit" value="Upload" />
</form>
---------------------------
uploading script ( this is where i need help to resize the picturs to 300 pixels height )
<?php
$listfolderid=$row_rsmem['mem_id'].time();
$numoffile = 1 + $_POST['expics'];
$mypath="/serversomepath/"."/".$listfolderid."/";
mkdir($mypath, 0777);
$file_dir = $mypath;
if ($_POST) {
for ($i=0;$i<$numoffile;$i++) {
if (trim($_FILES['myfiles']['name'][$i])!="") {
$newfile = $file_dir.$_FILES['myfiles']['name'][$i];
move_uploaded_file($_FILES['myfiles']['tmp_name'][$i],$newfile);
$j++;
}
}
}
if (isset($j)&&$j>0) print "<br><b>Your file(s) has been uploaded.</b><br>";
?>
-----------------------
Also, in the same script, how do i block non image files? ( i am not a fully grown php guy - so need help )
As far as blocking non-image files you can a few edit checks. A recent discussion on security prompted this PHP Peer Code Review [webmasterworld.com] that has some answers for you.