In my form I have it available to submit a story, with a photo. Then I have the story outputted as HTML to a folder, and I the image as well.

What I need is a way to auto name the story with atleast a few similar characters. Something that will link them together, so that you know story3 and image3 go together. And it needs to be the same kinda tag for each story and image that are submitted.

Let me know if you have any ideas. Thanks.

    TCovert- huh? you have a vague idea of what you want to do but you need to get more specific. think in very concrete, "computer" terms ...what should go where when what happens? once you hvae more of a "flowchart" in your head about how th eprogram will work, we cna probably help better with specific coding assistance.

    to take a stab at what you're talking about, sounds like:

    1. user submits text and an image file
    2. php puts the text and image into an html template
    3. those are written out into a new folder and file.

    now, take that and get more specific-- break down each step of the way... do you wnat the user to name the story? can you use that name to determine the folder name? do you kepe track of stories on an index page, or in a database? etc.

    best
    Eric

      Okay...you are going too far.

      This is what I need:

      When the user submits the story (which is pasted into a form) and image (which is selected in the form, it is sent to the database, and outputted to an html file.

      I have that.

      I need a way, that when the image is put in a location, and the html file is written to the same folder, they can be named in a similar way so you can tell that one photo goes with one story.

      The folder will already be in place.

        ok, gotcha. so can you just take the first few characters of the html filename and rename the image to that? or generate a unique string ID (see php.net/uniqid) and name them both using that.

        best
        Eric

          you can indeed use the unique() function or even just take the timestamp in seconds. Chances that users submit a story in the same second are small, and even then you could use checking for that aswell. you can also just keek a counter in a small textfile which is updated with every submit, or (if you have a database) use a sequence in the datbase. Anyway, you have plenty of methods - nothing special about it !

            I need an identifier in each photo name that can be referenced in the html file using a $var.

            So, when the story and photo are submitted, the html file created will also have a link in it to the photo that was submitted.

            So, the unique id won't work. I would like it to be something like story1 and photo1 story2 photo2...or something along those lines.

            I don't know..it is all very confusing.

              $unique_part = time();
              OR
              $unique_part = uniuqe() // look for the exact way to use this function ! I don't know it !

              $htmfilename = "html" . $unique_part . ".htm";
              $imagefilename = "image
              ". $unique_part . ".jpg";

              Just define the unique part once and use it twice ... or use the file (a textfile) which you use as a counter.

                Write a Reply...