Menu

Display recently Uploaded Image?

Help
2008-05-09
2013-06-03
  • Andy Thompson

    Andy Thompson - 2008-05-09

    I stumbled upon PHPform and it is EXACLT what I need, except for one thing:

    On the process.php page when it displays the submitted results, under the image it shows: Array.

    How can I edit the process.php file to actually display the image just uploaded?

     
    • TNTEverett

      TNTEverett - 2008-05-09

      I'm sure there is more than on epost here with the information you need but here it is again.

      $HTTP_POST_FILES['Attachment1']['name']

      Use this process.php variable where you want to display the name of the uploaded file. 
      "Attachment1" is the form field name from your form. 

       
    • Andy Thompson

      Andy Thompson - 2008-05-09

      You'll have to pardon my noobidity on this, but I'm fairly new to all this.

      My code is as follows:

      <table width=50%>
      <tr><td>Name: </td><td> <?php echo $Name; ?> </td></tr>
      <tr><td>Email: </td><td> <?php echo $Email; ?> </td></tr>
      <tr><td>File: </td><td> <?php echo $File; ?> </td></tr>
      </table>

      <!-- here is where I want the image to post-->

      ---------------------
      Where exactly do I put the $HTTP_POST_FILES['Attachment1']['name']
      Is 'name' just generic variable that I can rename to whatever and simply put
      <?php echo $name; ?>

      I appologize for the very simplistic questions, but any help you may give is greatly appreciated.

       
      • TNTEverett

        TNTEverett - 2008-05-09

        If $File is the field name from the form then somewhere near the top of your process.php insert the following:

        $name=$HTTP_POST_FILES['File']['name'];

        Then you can use
        <?php echo $name; ?>
        in your display.

        Without seeing both the form.html and the process.php file I can not give you exact instructions. 

         
    • dkaufman1

      dkaufman1 - 2008-07-24

      @ TNTEverett - I spent some time searching as you alluded to some other threads that might have more info, but I was not able to find them.  My question is similar to binarywasp.

      I built a small form for uploading up to 5 files.  On the auto-generated thank you page, the files are listed by label.

      File 1: Array
      File 2: Array
      etc.

      I am not sure how to show the file name (the image is even nicer, but not really needed).  I am also a PHP noob, but learning.

      Thanks for reviewing this.

       
      • TNTEverett

        TNTEverett - 2008-07-30

        Find the part of the process.php file that displays your file names.  It will look somthing like this:
        File 1: " . $_POST['field_3'] . "

        Change it to something like this:
        File 1: " . $_FILES['field_3']['name'] . "

         
    • dkaufman1

      dkaufman1 - 2008-07-25

      I just built a new form still all file fields of the file upload don't show a name.  They all say "array".

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.