Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

3 Neutral

About 0xMatt

  • Rank
  • Birthday 05/22/1990

Contact Methods

  • Website URL
  • Jabber

Profile Information

  • Gender
  • Location
    Pooptown, Arkansas
  1. 0xMatt

    Back online.

    To any of my fellow IRC users reading this, we are in ##phpfreaks on freenode until this is resolved, come play with us
  2. 0xMatt

    Back online.

    Any news on when IRC is gonna be back?
  3. Based on what you've said you know what you should do you just haven't written any code to do so. You want to insert the related IDs onto the thread tables image_file_id column as comma-separated-values. I may be misunderstanding your issue, but this is what it sounds like you want: <?php $desired_width = 110; if (isset($_POST['submit'])) { $j = 0; //Variable for indexing uploaded image for ($i = 0; $i < count($_FILES['file']['name']); $i++) {//loop to get individual element from the array $target_path = $_SERVER['DOCUMENT_ROOT'] . "/gallerysite/multiple_image_upload/uploads/"; //Declaring Path for uploaded images $validextensions = array("jpeg", "jpg", "png"); //Extensions which are allowed $ext = explode('.', basename($_FILES['file']['name'][$i]));//explode file name from dot(.) $file_extension = end($ext); //store extensions in the variable $new_image_name = md5(uniqid()) . "." . $ext[count($ext) - 1]; $target_path = $target_path . $new_image_name;//set the target path with a new name of image $j = $j + 1;//increment the number of uploaded images according to the files in array if (($_FILES["file"]["size"][$i] < 100000) //Approx. 100kb files can be uploaded. && in_array($file_extension, $validextensions)) { if (move_uploaded_file($_FILES['file']['tmp_name'][$i], $target_path)) {//if file moved to uploads folder echo $j. ').<span id="noerror">Image uploaded successfully!.</span><br/><br/>'; $tqs = "INSERT INTO images (`original_image_name`, `image_file`, `date_created`) VALUES ('" . $_FILES['file']['name'][$i] . "', '" . $new_image_name . "', now())"; $tqr = mysqli_query($dbc, $tqs); // Select the ID numbers of the last inserted images and store them inside an array. // Use the implode() function on the array to have a string of the ID numbers separated by commas. // Store the ID numbers in the "image_file_id" column of the "thread" table. $tqs = "SELECT `id` FROM `images` WHERE `image_file` IN ('$new_image_name')"; $tqr = mysqli_query($dbc, $tqs) or die(mysqli_error($dbc)); $fetch_array = array(); $row = mysqli_fetch_array($tqr); $fetch_array[] = $row['id']; /* * This prints e.g.: Array ( [0] => 542 ) Array ( [0] => 543 ) Array ( [0] => 544 ) */ $values = rtrim(implode(', ', $fetch_array)); // Should print, "542, 543, 544" no whitespace if(!mysqli_query($dbc, "INSERT INTO thread (image_file_id) VALUES ('{$values}')")) { die(mysqli_error($dbc)); } // Goes over to create the thumbnail images. $src = $target_path; $dest = $_SERVER['DOCUMENT_ROOT'] . "/gallerysite/multiple_image_upload/thumbs/" . $new_image_name; make_thumb($src, $dest, $desired_width); } else {//if file was not moved. echo $j. ').<span id="error">please try again!.</span><br/><br/>'; } } else {//if file size and file type was incorrect. echo $j. ').<span id="error">***Invalid file Size or Type***</span><br/><br/>'; } } } If this isn't what you want, I would need you to elaborate more on what your end goal is.
  4. Here's the same question you're asking over on reddit. The first response is by the creator of Laravel. Also, googling the phrase "why choose Laravel" yields a lot of results. I've been using it quite some time, and though I'd really like to learn Symfony, I'm fine with Laravel for the time being.
  • 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.