Menu

multiple file uploads

Help
2008-05-25
2013-06-03
  • Peter Heath

    Peter Heath - 2008-05-25

    Great program!
    I am using version 2.09c
    Everything works fine except the users of the form can only upload a single file when using the form. That is when the file dialogue/ search box comes up you can only select one file.
    How do I change this? Any help is greatly appreciated. I can donate $20 if this saves me headaches.
    Thank you
    Pete
    I will do it if you can sort this easily.

    Code is

    <?php
    include("global.inc.php");
    $errors=0;
    $error="The following errors occured while processing your form input.<ul>";
    pt_register('POST','Briefdescriptionofactincludingpricingstructure');
    $Briefdescriptionofactincludingpricingstructure=preg_replace("/(\015\012)|(\015)|(\012)/","&nbsp;<br />", $Briefdescriptionofactincludingpricingstructure);pt_register('POST','CityorStatebasedin');
    pt_register('POST','Website');
    pt_register('POST','ContactName');
    pt_register('POST','EmailAddress');
    pt_register('POST','confirmemailaddress');
    pt_register('POST','Streetaddress');
    pt_register('POST','SuburbandCity');
    pt_register('POST','State');
    pt_register('POST','Postcode');
    pt_register('POST','BusinessHoursphone');
    pt_register('POST','Mobile');
    $SubmitBiography=$HTTP_POST_FILES['SubmitBiography'];
    $SubmitPhotos=$HTTP_POST_FILES['SubmitPhotos'];
    $SubmitDemoVideo=$HTTP_POST_FILES['SubmitDemoVideo'];
    if($Briefdescriptionofactincludingpricingstructure=="" || $CityorStatebasedin=="" || $ContactName=="" || $EmailAddress=="" || $confirmemailaddress=="" || $SuburbandCity=="" || $State=="" || $BusinessHoursphone=="" || $Mobile=="" ){
    $errors=1;
    $error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
    }
    if($HTTP_POST_FILES['SubmitBiography']['tmp_name']==""){ }
    else if(!is_uploaded_file($HTTP_POST_FILES['SubmitBiography']['tmp_name'])){
    $error.="<li>The file, ".$HTTP_POST_FILES['SubmitBiography']['name'].", was not uploaded!";
    $errors=1;
    }
    if($HTTP_POST_FILES['SubmitPhotos']['tmp_name']==""){ }
    else if(!is_uploaded_file($HTTP_POST_FILES['SubmitPhotos']['tmp_name'])){
    $error.="<li>The file, ".$HTTP_POST_FILES['SubmitPhotos']['name'].", was not uploaded!";
    $errors=1;
    }
    if($HTTP_POST_FILES['SubmitDemoVideo']['tmp_name']==""){ }
    else if(!is_uploaded_file($HTTP_POST_FILES['SubmitDemoVideo']['tmp_name'])){
    $error.="<li>The file, ".$HTTP_POST_FILES['SubmitDemoVideo']['name'].", was not uploaded!";
    $errors=1;
    }
    if($errors==1) echo $error;
    else{
    $image_part = date("h_i_s")."_".$HTTP_POST_FILES['SubmitBiography']['name'];
    $image_list[12] = $image_part;
    copy($HTTP_POST_FILES['SubmitBiography']['tmp_name'], "files/".$image_part);
    $image_part = date("h_i_s")."_".$HTTP_POST_FILES['SubmitPhotos']['name'];
    $image_list[13] = $image_part;
    copy($HTTP_POST_FILES['SubmitPhotos']['tmp_name'], "files/".$image_part);
    $image_part = date("h_i_s")."_".$HTTP_POST_FILES['SubmitDemoVideo']['name'];
    $image_list[14] = $image_part;
    copy($HTTP_POST_FILES['SubmitDemoVideo']['tmp_name'], "files/".$image_part);
    $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
    $message="Brief description of act including pricing structure: ".$Briefdescriptionofactincludingpricingstructure."
    City or  State based in: ".$CityorStatebasedin."
    Website: ".$Website."
    Contact Name: ".$ContactName."
    Email Address: ".$EmailAddress."
    confirm email address: ".$confirmemailaddress."
    Street address: ".$Streetaddress."
    Suburb and City: ".$SuburbandCity."
    State: ".$State."
    Postcode: ".$Postcode."
    Business Hours phone: ".$BusinessHoursphone."
    Mobile: ".$Mobile."
    Submit Biography: ".$where_form_is."files/".$image_list[12]."
    Submit Photos: ".$where_form_is."files/".$image_list[13]."
    Submit Demo Video: ".$where_form_is."files/".$image_list[14]."
    ";
    $message = stripslashes($message);
    mail("example@ somewhere.com.au","Form Submitted at your new ZOOM website. Ask Pete where to get the files submitted",$message,"From: phpFormGenerator");
    $make=fopen("admin/data.dat","a");
    $to_put="";
    $to_put .= $Briefdescriptionofactincludingpricingstructure."|".$CityorStatebasedin."|".$Website."|".$ContactName."|".$EmailAddress."|".$confirmemailaddress."|".$Streetaddress."|".$SuburbandCity."|".$State."|".$Postcode."|".$BusinessHoursphone."|".$Mobile."|".$where_form_is."files/".$image_list[12]."|".$where_form_is."files/".$image_list[13]."|".$where_form_is."files/".$image_list[14]."
    ";
    fwrite($make,$to_put);
    ?>

    <!-- This is the content of the Thank you page, be careful while changing it -->

    <h2>Thank you! from ZOOM Entertainment</h2>

    <table width=50%>
    <tr><td>Brief description of act including pricing structure: </td><td> <?php echo $Briefdescriptionofactincludingpricingstructure; ?> </td></tr>
    <tr><td>City or  State based in: </td><td> <?php echo $CityorStatebasedin; ?> </td></tr>
    <tr><td>Website: </td><td> <?php echo $Website; ?> </td></tr>
    <tr><td>Contact Name: </td><td> <?php echo $ContactName; ?> </td></tr>
    <tr><td>Email Address: </td><td> <?php echo $EmailAddress; ?> </td></tr>
    <tr><td>confirm email address: </td><td> <?php echo $confirmemailaddress; ?> </td></tr>
    <tr><td>Street address: </td><td> <?php echo $Streetaddress; ?> </td></tr>
    <tr><td>Suburb and City: </td><td> <?php echo $SuburbandCity; ?> </td></tr>
    <tr><td>State: </td><td> <?php echo $State; ?> </td></tr>
    <tr><td>Postcode: </td><td> <?php echo $Postcode; ?> </td></tr>
    <tr><td>Business Hours phone: </td><td> <?php echo $BusinessHoursphone; ?> </td></tr>
    <tr><td>Mobile: </td><td> <?php echo $Mobile; ?> </td></tr>
    <tr><td>Submit Biography: </td><td> <?php echo $SubmitBiography; ?> </td></tr>
    <tr><td>Submit Photos: </td><td> <?php echo $SubmitPhotos; ?> </td></tr>
    <tr><td>Submit Demo Video: </td><td> <?php echo $SubmitDemoVideo; ?> </td></tr>
    </table>
    <!-- Do not change anything below this line -->

    <?php
    }
    ?>

     
    • TNTEverett

      TNTEverett - 2008-05-25

      There are no standard file upload features that allow you to select multiple files.  The easiest thing is to have a separate field for each file to be uploaded.  If you are still interested in a single field then check out the link below.  It's non-standard but does do a pretty good jod at achieving the effect. 

      http://the-stickman.com/web-development/javascript/multiple-file-uploader-mootools-version/

       
    • Peter Heath

      Peter Heath - 2008-05-26

      Hi
      I went to that link and thought I had it but I really have no idea about writing code!!!!

      To place 6 upload boxes on the form for pictures and have them process, what do I do?
      I tried to do it but just made a mess :-)

      Thanks Pete and I will donate when this is sorted.
      Below is a copy of the code of the form page , where I want to put the extra boxes is at the bottom and separated so you can find it easily.
      Thanks again
      Pete

      <meta name="description" content="Fill out this form to submit your Act for ZOOM's approval and inclusion to our entertainment listings">
      <title>New Act Submit Form</title><body background="../../images/website/starsglow1.gif"><meta name="description" content="New Act Submit Form">
      <form enctype='multipart/form-data' action='process.php' method='post'>
      <table border="1" cellspacing="1" style="border-collapse: collapse" bordercolor="#000066" width="95%" cellpadding="5">
      <tr>
            <td colspan="3" bgcolor="#B5CBEF" height="17" width="100%" bordercolor="#FFFFFF" background="tile_back.gif">
              <p align="center"Verdana" size="2" color="#FFFFFF"> <font face='Verdana' size=2 color='#FFFFFF'><b>
                &nbsp; <img src="../../images/website/zoom-logo-transparent.gif" width="459" height="211
              <p align="center"Verdana" size="2" color="#FFFFFF">
              <p align="center"Verdana" size="2" color="#FFFFFF"><b><font color="#FF6633" size="7" face="Verdana">ZOOM
                Entertainment</font></b> <b><font color="#FF6633" size="6" face="Verdana">
                <br>
                New Act Submission Form</font></b></td>
      </tr><tr>
            <td colspan="3" bgcolor="#B5CBEF" height="16" width="100%" bordercolor="#FFFFFF" background="tile_sub.gif"><font size="2" face="Verdana"><b><font face="Verdana" size="3" color="#000066">
              <!- You can add a brief form description here-->
              To add your act to our growing list please fill out the form below and
              our office will contact you promptly.<br> ZOOM Entertainment will endeavour
              to find suitable work for you and will add a small agency fee contained
              in the quote to the client.<br> You will need to agree to our terms and conditions
              contained on the booking forms before securing these placements. </font></b></font></td>
          </tr><tr><td colspan="3" bgcolor="#D6DFEF" height="16" width="100%" bordercolor="#FFFFFF"><font size="1" face="Verdana">Please fill in all fields marked with a *</font></td></tr><tr><td height="30" width="55" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <img border="0" src="../../images/website/zoom-logo-transparent-forms.gif" width="60" height="32"></td><td height="30" width="189" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana" size="2">Brief description of act including pricing structure quoting for 1hr, 2hr, 3hr and 4 hr calls</td>
      <td height="30" width="469" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana"><textarea name='Briefdescriptionofactincludingpricingstructure' rows=8 cols=60></textarea>*</td></tr><tr><td height="30" width="55" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <img border="0" src="../../images/website/zoom-logo-transparent-forms.gif" width="60" height="32"></td><td height="30" width="189" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana" size="2">City or  State based in</td>
      <td height="30" width="469" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana"><input type=text name='CityorStatebasedin'>*</td></tr><tr><td height="30" width="55" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <img border="0" src="../../images/website/zoom-logo-transparent-forms.gif" width="60" height="32"></td><td height="30" width="189" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana" size="2">Website</td>
      <td height="30" width="469" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana"><input type=text name='Website'></td></tr><tr><td height="30" width="55" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <img border="0" src="../../images/website/zoom-logo-transparent-forms.gif" width="60" height="32"></td><td height="30" width="189" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana" size="2">Contact Name and ABN</td>
      <td height="30" width="469" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana"><input type=text name='ContactName'>*</td></tr><tr><td height="30" width="55" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <img border="0" src="../../images/website/zoom-logo-transparent-forms.gif" width="60" height="32"></td><td height="30" width="189" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana" size="2">Email Address</td>
      <td height="30" width="469" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana"><input type=text name='EmailAddress'>*</td></tr><tr><td height="30" width="55" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <img border="0" src="../../images/website/zoom-logo-transparent-forms.gif" width="60" height="32"></td>
            <td height="30" width="189" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> <font face="Verdana" size="2">Confirm
              email address</td>
      <td height="30" width="469" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana"><input type=text name='confirmemailaddress'>*</td></tr><tr><td height="30" width="55" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <img border="0" src="../../images/website/zoom-logo-transparent-forms.gif" width="60" height="32"></td><td height="30" width="189" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana" size="2">Street address</td>
      <td height="30" width="469" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana"><input type=text name='Streetaddress'></td></tr><tr><td height="30" width="55" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <img border="0" src="../../images/website/zoom-logo-transparent-forms.gif" width="60" height="32"></td><td height="30" width="189" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana" size="2">Suburb and City</td>
      <td height="30" width="469" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana"><input type=text name='SuburbandCity'>*</td></tr><tr><td height="30" width="55" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <img border="0" src="../../images/website/zoom-logo-transparent-forms.gif" width="60" height="32"></td><td height="30" width="189" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana" size="2">State</td>
      <td height="30" width="469" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana"><select name='State'><option value='Victoria'>Victoria<option value='New South Wales'>New South Wales<option value='Queensland'>Queensland<option value='Northern Territory'>Northern Territory<option value='Western Australia'>Western Australia<option value='South Australia'>South Australia<option value='Tasmania'>Tasmania</select>*</td></tr><tr><td height="30" width="55" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <img border="0" src="../../images/website/zoom-logo-transparent-forms.gif" width="60" height="32"></td><td height="30" width="189" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana" size="2">Postcode</td>
      <td height="30" width="469" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana"><input type=text name='Postcode'></td></tr><tr><td height="30" width="55" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <img border="0" src="../../images/website/zoom-logo-transparent-forms.gif" width="60" height="32"></td><td height="30" width="189" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana" size="2">Business Hours phone</td>
      <td height="30" width="469" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana"><input type=text name='BusinessHoursphone'>*</td></tr><tr><td height="30" width="55" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <img border="0" src="../../images/website/zoom-logo-transparent-forms.gif" width="60" height="32"></td><td height="30" width="189" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana" size="2">Mobile</td>
      <td height="30" width="469" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana"><input type=text name='Mobile'>*</td></tr><tr><td height="30" width="55" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <img border="0" src="../../images/website/zoom-logo-transparent-forms.gif" width="60" height="32"></td><td height="30" width="189" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana" size="2">Submit Biography <br>
              A well written description of your Act. Please include whether you are
              GST registered and are you covered by Public Liability and Indemnity Insurance
              If you have a song repertoire please include it.</td>
      <td height="30" width="469" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana"><input type='file' name='SubmitBiography'>
              *</td>
        

      </tr><tr><td height="30" width="55" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <img border="0" src="../../images/website/zoom-logo-transparent-forms.gif" width="60" height="32"></td>
            <td height="30" width="189" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> <font face="Verdana" size="2">Submit
              Photos <br> Please no photos less than 50kb and no more than 2MB in total</td>
      <td height="30" width="469" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana"><input type='file' name='SubmitPhotos'>
              *</td>

          </tr><tr><td height="30" width="55" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <img border="0" src="../../images/website/zoom-logo-transparent-forms.gif" width="60" height="32"></td>
            <td height="30" width="189" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> <font face="Verdana" size="2">Submit
              Demo Video<br> No larger than 3MB </td>
      <td height="30" width="469" bgcolor="#EFF3F7" bordercolor="#FFFFFF">
      <font face="Verdana"><input type='file' name='SubmitDemoVideo'></td></tr><tr><td colspan="3" bgcolor="#B5CBEF" height="25" width="737" background="tile_sub.gif"><p align="center"><font face="Verdana" size="2"><input type=submit value='Submit Form'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type=reset value='Reset Form'></font></td></tr>
      </table></form> <br><br><a href='http://phpformgen.sourceforge.net'><img src='button.jpg' border=0></a>

       

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.