Fallen_angel Posted February 23, 2007 Share Posted February 23, 2007 I have a script in which I allow users to upload 4 files , this script works fine and does the job I want perfectly , However I wanted to add a comments section for each of the images , I tried playing around a little but I can't seem to get it to work so if someon could help me here i woudl really apreciate it the relivant part of the forum itself says <?php // max number of files allowed to upload at one tome define ( 'MAX_FILES', '4' ); for ( $i = 1; $i <= MAX_FILES; $i++ ) { echo " <tr><td>Image Comments</td><td><TEXTAREA rows='2' cols='35' name='comments[$i]' ></textarea></td></tr>\r\n"; echo " <tr><td>Select image</td><td><input type='file' name='up[$i]' size='36'></td></tr>\r\n"; echo " <br />\r\n"; } ?> Now as mentioned the "up" one works fine as part of the bellow upload script however I am not sure how to echo the comments on the next page which is what i need help with <?php define ( 'UPLOAD_PATH', '../uploads/' ); // max number of files allowed to upload at one tome define ( 'MAX_FILES', '4' ); // define the max single file size (bytes) define ( 'MAX_SIZE', '1048576' ); // allowed types $allow = array ( 'png', 'jpg' ); /* e - config */ if ( ! empty ( $_POST['send'] ) ) { $return = array(); $x = 1; for ( $i = 1; $i <= sizeof ( $_FILES['up'] ); $i++ ) { if ( is_uploaded_file ( $_FILES['up']['tmp_name'][$i] ) ) { if ( $_FILES['up']['tmp_name'][$i] != 'none' ) { $ss = filesize ( $_FILES['up']['tmp_name'][$i] ); if ( $ss > 10 && $ss <= MAX_SIZE ) { $sn = strtolower ( $_FILES['up']['name'][$i] ); $ran= md5(rand() * time()); // make a random filename $randName = $ran."." ; $ce = substr ( $sn, ( strrpos ( $sn, '.' ) + 1 ) ); if ( in_array ( $ce, $allow ) ) { if ( move_uploaded_file ( $_FILES['up']['tmp_name'][$i], UPLOAD_PATH . $randName.$ce ) ) { $return[$x]['name'] = $randName; $return[$x]['type'] = $ce; $return[$x]['size'] = $ss; $x++; } } } } } } } ?> <html> <head> <?php if ( ! empty ( $return ) ) { ?> <div align='center'> <table width='672'> <tr> <td align='center'>FILES UPLOADED</td> </tr> <tr> <td> <table width='100%'> <tr> <td align='center' width='4%' height='21'>#</td> <td width='2%'></td> <td align='center' width='52%' height='21'>FILE NAME</td> <td width='2%'></td> <td align='center' width='24%' height='21'>FILE SIZE</td> <td width='2%'></td> <td align='center' width='16%' height='21'>FILE TYPE</td> </tr> <?php for ( $i = 1; $i <= sizeof ( $return ); $i++ ) { echo " <tr> <td align='center' width='4%' height='21'>" . ( $i < 10 ? '0' . $i : $i ) . "</td> <td width='2%'></td> <td align='center' width='52%' height='21'>" . $return[$i]['name'] . "</td> <td width='2%'></td> <td align='center' width='24%' height='21'>" . $return[$i]['size'] . " bytes</td> <td width='2%'></td> <td align='center' width='16%' height='21'>" . $return[$i]['type'] . "</td> </tr> "; } ?> </table> </td> </tr> <tr> <td width='100%' height='8'></td> </tr> </table> </div> <a href="javascript:history.back()"><< Go Back</a> </body> </html> thankyou to anyone that can assist me with this I would really apreciate it basicly all I need to be shown is how i can call the comments aray from the previous forum Link to comment https://forums.phpfreaks.com/topic/39734-bulk-upload-script/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.