Hi

I have created a cms system for a small 5 page site. The edit page edits the text of each page.

Now I want the user to be able to download an image at the same time as they are editing the text. In other words, they edit the text and then upload the image from the computer to their database. This creates a hyperlink. which sets the image to be downloaded to the page. When the user clicks the submit button at the bottom of the edit form the text is updated and the image downloaded.

I am using mediumblob

At the moment I can do all the above actions but only by using two forms.

Is it possible to place the upload image action within the edit text form?

how is this best done?

cass27

    ask a text, and upload a file. the target can be a _blank page on your form next to an action. With this submit the user uploaded the file,and send the text in one submit.

    after you saved the file into a database, you can send the created image with readfile. The user will see a file download.

    is it what you're need?

      djjjozsi;10917192 wrote:

      ask a text, and upload a file. the target can be a _blank page on your form next to an action.

      ask a text? What do you mean?

      when you talk about a target do you mean the alt?

      anyway what I mean is I need to combine the two forms, (a) text editing and (b) image download in the same form. I am unsure of the code for this?

      cass27

        <form target="_blank" action="download.php">

        you take a field with the value you need to edit, and use a hidden field to identify the row you need..

        on download.php you update the texts with the $_POST["text"]

        no output on download.php, but send the image you need with readfile()

          djjjozsi;10917221 wrote:

          <form target="_blank" action="download.php">

          you take a field with the value you need to edit, and use a hidden field to identify the row you need..

          on download.php you update the texts with the $_POST["text"]

          no output on download.php, but send the image you need with readfile()

          sorry still confused. could you give a short example of what the form would look like?

          cass27

            at the same time as they are editing the text.

            uploader form + text input to edit a text you can insert the two form into one big form.

            <form target="_blank" method="post" enctype="multipart/form-data">
            <table width="350" border="0" cellpadding="1" cellspacing="1" >
            <tr>
            <td width="246"><input type="hidden" name="MAX_FILE_SIZE" value="2000000" />
            <input name="usertext" type="text" id="usertext" />
            <input name="userfile" type="file" id="userfile" />
            </td>
            <td width="80"><input name="upload" type="submit" class="box" id="upload" value=" Upload " /></td>
            </tr>
            </table>
            </form>

            =>>>
            you upload the image, and use the inserted $_POST["text"] to update the database. Or what ever you want to do with that text? you want to insert the text into the image? After you change the image, you can set an image header to output the image.

            header('Content-Type: image/jpeg');
            $img = LoadJpeg('imageyouwant.jpg');
            imagejpeg($img);

              thanks for that. I shall give it a try.

              cass27

                Write a Reply...