Jump to content

samtwilliams

Members
  • Posts

    70
  • Joined

  • Last visited

Everything posted by samtwilliams

  1. thanks, solved by if($valid_file) { //move it to where we want it to be $target_path = "/home/sites/xxxxxx.co.uk/public_html/yourphotos/uploads/"; $target_path = $target_path . basename( $_FILES['photo']['name']); move_uploaded_file($_FILES['photo']['tmp_name'], $target_path); $message = 'Congratulations! Your file was accepted.'; }
  2. Hi All, I have this issue when upload a file using an uploader i made. For the life of me I cant figure out why it won't write the file. Error: [Sat Jun 21 20:45:40 2014] [error] [client xxxxxxx] AH01215: PHP Warning: move_uploaded_file() [<a href='function.move-uploaded-file'>function.move-uploaded-file</a>]: Unable to move '/tmp/phpUsCyXG' to '/home/sites/xxxxxx.co.uk/public_html/yourphotos/uploads/' in /home/sites/xxxxxxx.co.uk/public_html/yourphotos/index.php on line 31 My PHP <?php //if they DID upload a file... $message = ''; if($_FILES['photo']['name']) { $valid_file = true; //if no errors... if(!$_FILES['photo']['error']) { //now is the time to modify the future file name and validate the file $new_file_name = strtolower($_FILES['photo']['tmp_name']); //rename file if($_FILES['photo']['size'] > (26214400)) //can't be larger than 25MB { $valid_file = false; $message = 'Oops! Your file\'s size is to large.'; echo $_FILES['photo']['size']; } if($_FILES['photo']['size'] < (1572864)) //can't be smaller than 1.5MB { $valid_file = false; $message = 'Oops! Your file\'s size is to small.'; echo $_FILES['photo']['size']; } //if the file has passed the test if($valid_file) { //move it to where we want it to be move_uploaded_file($_FILES['photo']['tmp_name'], '/home/sites/xxxxxxxx.co.uk/public_html/yourphotos/uploads/'); $message = 'Congratulations! Your file was accepted.'; } } //if there is an error... else { //set that to be the returned message $message = 'Ooops! Your upload triggered the following error: '.$_FILES['photo']['error']; } } ?> <html> <body> <form action="index.php" method="post" enctype="multipart/form-data"> Your Photo: <input type="file" name="photo" size="25" /> <input type="submit" name="submit" value="Submit" /> <?PHP echo $message; ?> </form> </body> </html> I have set the uploads file to have write permissions as well. Sam
  3. I need to use tables, still can't get it to work, my table just looks a mess.
  4. I am trying to draw a table dynamically, I need a table that is 5 x 5, i know i'm close quite my code by just can't quite fathom it out. My sql returns 25 results which i want to return 25 cells in a square table. <?PHP $i = 0; while($row = mysql_fetch_assoc($result)) { $i++; ?> <?PHP if($i== 5) { echo '<tr>'; } ?> <td class="right bottom"><?PHP echo $row['GridID']; ?></td> <td class="right bottom"> </td> <td class="right bottom"> </td> <td class="right bottom"> </td> <td class="bottom"> </td> <?PHP if($i== 5) { echo '</tr>'; $i=0; } ?>
  5. I need to selected the subscriber_Id from another tabled based on an email address, can't seem to work out why this nested select won't work. Can someone help Thanks Sam INSERT INTO `pommo_subscriber_data` ( `data_id` , `field_id` , `subscriber_id` , `value` ) VALUES ( NULL , '1', (SELECT `pommo_subscribers`.`subscriber_id` FROM `pommo_subscribers` WHERE `pommo_subscribers`.`email` = 'samtwilliams23'ORDER BY `pommo_subscribers`.`subscriber_id` DESC), 'SamTEST');
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.