Should be able to do it with Bootstrap grid columns. Make a "row" element, then in your PHP, as you iterate through N number of things to display, you make N number of "col" class elements of the desired column-width.

http://getbootstrap.com/css/#grid-options

<div class="row">
<?php foreach($something as $text) { ?>
  <div class="col-md-3"><?php echo $text; ?></div>
<?php } ?>
</div>

(Very simplified w.r.t. what you'd output in the grid element 🙂 )

    So are you saying I would have to store the file names in 'phpMyadmin', and fetch them and loop through them whenever the page is loaded?

      Paul help!;11062319 wrote:

      So are you saying I would have to store the file names in 'phpMyadmin', and fetch them and loop through them whenever the page is loaded?

      I was not discussing how to store/retrieve the data, just a way that PHP can work in conjunction with Bootstrap -- which I thought was the question? If the content is going to be dynamic based on what users upload, then you'll need to store the relevant data somewhere in a way you can retrieve them as/when needed. A database would seem to be a solid choice for that sort of thing, but it could also be done via the file system -- but that would not scale as well as a DB.

      A typical approach would be that, upon successful upload, you store the file in a chosen directory with a unique file name; and then you record that file name in a database record along with relevant information, such as user ID, title, description, date uploaded, or whatever else you are interested in. Then you can query the DB on a page load, perhaps in this example based on the user ID in order to display only that user's images. In that case your loop would be iterating on a database result fetch.

        Thanks. When you say:

        A typical approach would be that, upon successful upload, you store the file in a chosen directory with a unique file name; and then you record that file name in a database record along with relevant information, such as user ID

        ..... I am just wondering. How would I enusre the file name is a unique one, when I have no control over what my client uploads?

          Assuming you are using the move_uploaded_file() function, you can use whatever you want for the 2nd argument, the "destination". It could be something as simple(?) as prepending the user's file name with their user ID and a timestamp, something like:

          $fileName = $user_id . '_' . date('YmdHis') . '_'. basename($_FILES['file']['tmp_name']);
          move_uploaded_file($_FILES['file']['tmp_name'], $_SERVER['DOCUMENT_ROOT'] ."/images/users/$fileName");
          

            Thanks NogDog.

            What does:

            $_SERVER['DOCUMENT_ROOT']

            .... return exactly?

            And another thing I need to ask is - how would I go about automatically creating thumbnails which are of uniform size, whenever my client uploads a new image? Are there any php functions for clipping images, etc?

            Also, are there any functions that will literally delete files stored in the images folder on the server? So my client has the option of deleting images he doesn't want on his gallery any more?

              From [man]reserved.variables.server[/man]:

              '[font=monospace]DOCUMENT_ROOT[/font]'
              The document root directory under which the current script is executing, as defined in the server's configuration file.

                I was also wondering about uploading multiple (image) files at once.

                How is this achieved through php and html??

                  I am familiar with the $_FILES superglobal. But how does it hold more than one file (image in my case)? could you give me some illustration code?

                    If you do multiple uploads using the array syntax in the form element name, you get an additional array index for each of the $FILES elements.

                    <input type='file' name='userfile[]'>
                    <input type='file' name='userfile[]'>
                    <input type='file' name='userfile[]'>
                    
                    <h2>Uploaded File Names</h2>
                    <ul>
                    <?php
                    foreach($FILES['userfile']['tmp_name'] as $key) {
                      echo "<li>".$_FILES['userfile']['tmp_name'][$key]."</li>\n";
                    }
                    ?>
                    </ul>
                    

                      Thanks guys.

                      I just wanted to ask something.

                      I can't seem to edit my original post at the top of this thread.

                      I just wanted to remove the link to my clients website.

                      For some reason there is no option to edit it.

                        There's a grace period of some length, after which you cannot edit it. (I do not know how long it is.)

                        I'll go delete the link now. 🙂

                          Thanks man.

                          I was just wondering (because I am kind of nosey).

                          There are some really familiar people on here, like yourself (NogDog) and others like 'weed packet' and 'laserlight'.

                          I was just wondering. Do you guys work for phpbuilder (this website)?

                            We're volunteer (i.e. unpaid) moderators here. If you see anyone with something about "admin" under their name, they probably work for the company that owns this site.

                              I just need to ask.

                              Does:

                              basename($_FILES['file']['tmp_name']);

                              ... and:

                              basename($_FILES['file']['name']);

                              ... ultimately return the same thing?

                              Also, it looks to me like the input (file type) element can only hold one file:

                              <input type='file' name='userfile[]'>
                              <input type='file' name='userfile[]'>
                              <input type='file' name='userfile[]'>

                              .... judging by the illustration code you sent me earlier (extract above) in the post.

                              Is there no way of only using one input element and selecting multiple files (images) when the browse window pops up (instead of having to use multiple 'input elements' for each individual image I want to upload)?

                                Paul help!;11062407 wrote:

                                I just need to ask.

                                Does:

                                ... and:

                                ... ultimately return the same thing?

                                Probably, but not 100% sure if there would ever be a discrepancy -- nor if it matters which you use.

                                Also, it looks to me like the input (file type) element can only hold one file:

                                <input type='file' name='userfile[]'>
                                <input type='file' name='userfile[]'>
                                <input type='file' name='userfile[]'>

                                .... judging by the illustration code you sent me earlier (extract above) in the post.

                                Is there no way of only using one input element and selecting multiple files (images) when the browse window pops up (instead of having to use multiple 'input elements' for each individual image I want to upload)?

                                Yes, I'm pretty sure there is a way -- but I'd have to Google it, too. And my first result is: http://php.net/manual/en/features.file-upload.multiple.php

                                  Well, yes, there is a difference; as described in [man]features.file-upload.post-method[/man]; [font=monospace]name[/font] is the name the file the user had given it before uploading it. But the server saves all uploaded files in a temp directory until you (through your application) decide what to do with them, and if two people upload a file called "bike.png" at the same time then one would trash the other. Not good. So the server saves each file in the temp directory with a distinct temporary name that won't clash with any already in the temp directory. That name is provided to you in the [font=monospace]tmp_name[/font] field.

                                  HTML5 does offer a "multiple" setting for its file input fields, but HTML 4 didn't, and I don't know if the developers have got around to updating PHP's handling (since the page dalecosp and NogDog link to don't mention anything about it, in the absence of anything else in the manual to the contrary, I'll surmise not).