Closed Thread
Results 1 to 6 of 6

Thread: Upload function in a form help (php maybe?)

  1. #1
    Junior Member Shemo is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    21

    Upload function in a form help (php maybe?)

    I'm trying to see if someone is willing to build or point me in the direction of some sort of upload function for a form I've built for my newly created website. I want to allow visitors to upload photos to us, but I know 0 php and 0 javascript.

    In the form, I'm hoping that maybe it is able to allow the user to browse for the photo, upload the photo, and attach it in the email that goes along with the rest of the form...if not, at least provide a url to where the photo was uploaded on the server when the email is sent after the form is submitted.

    any help is appreciated.
    -Shemo

  2. #2
    It gets better. Dynash has a brilliant futureDynash has a brilliant futureDynash has a brilliant futureDynash has a brilliant futureDynash has a brilliant futureDynash has a brilliant futureDynash has a brilliant futureDynash has a brilliant futureDynash has a brilliant futureDynash has a brilliant futureDynash has a brilliant future
    Join Date
    Jan 2008
    Location
    United Kingdom
    Posts
    4,531
    It's not just a form, you need to have the backend coded too.
    Here is one: http://www.webanax.com/download/dc.php?dcid=46977372
    JavaKrypt

    "If you think education is expensive. You should see the cost of ignorance."

  3. #3
    Hrm? Tree is a name known to allTree is a name known to allTree is a name known to allTree is a name known to allTree is a name known to allTree is a name known to allTree is a name known to all Tree's Avatar
    Join Date
    Aug 2005
    Location
    /home
    Posts
    3,059
    Life is very short, and there's no time for fussing and fighting my friend.

  4. #4
    Junior Member Shemo is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    21
    I already have a php processor a friend built for me a while back when I redid my gaming clan's webpage...I just reuse it for all my forms and edit out the code as needed, so basically from looking on the pages, I'd just insert the upload function code into the form and link it in the php file by it's "name" ?

    attached is the php processor I've been using. (note, it's set to process a join request for my gaming clan, so go lite).

    Code:
    <?php
    
    $why_join_ae = $_POST["whyjoinae"];
    $clan_requirements = $_POST["requirement"];
    $headset_microphone = $_POST["headset"];
    $xfire_teamspeak = $_POST["comms"];
    $aviable_to_game = $_POST["available"];
    $xfire_name = $_POST["xfire"];
    $gaming_name = $_POST["gamingname"];
    $age = $_POST["age"];
    $bday = $_POST["bday"];
    $location = $_POST["location"];
    $email_address = $_POST["email"];
    $internet_type = $_POST["internet"];
    $game_playing = $_POST["joinae"];
    $invited_to_join = $_POST["whoasked"];
    $another_clan = $_POST["clan"];
    $what_clan = $_POST["whatclan"];
    $why_left = $_POST["anotherclan"];
    $computer_specs = $_POST["pc"];
    
    $address_to = "shemo@absoluteeliteclan.com";
    $address_from = "From: joinae@absoluteeliteclan.com";
    $email_subject_line = $gaming_name . "'s application to join AE";
    
    $email_text = "Why have you decided to join AE? " . $why_join_ae . 
    "\nHave you read and agreed to the clan requirements? " . $clan_requirements .
    "\nDo you have a headset and/or microphone? " . $headset_microphone .
    "\nDo you have Xfire and Teamspeak? " . $xfire_teamspeak .
    "\nHow often are you able to game? " . $aviable_to_game .
    "\nWhat is your Xfire name? " . $xfire_name .
    "\nWhat is your gamining name? " . $gaming_name .
    "\nHow old are you? " . $age .
    "\nWhat is your birthday? " . $bday .
    "\nLocation-state & Country? " . $location .
    "\nWhat is your email address? " . $email_address .
    "\nWhat is your internet connection? " . $internet_type .
    "\nWhat game were you playing when asked to join AE? " . $game_playing .
    "\nWho asked you to join AE? " . $invited_to_join .
    "\nWere you ever part of another clan? " . $another_clan .
    "\nIf you answered yes, what clan were you part of? " . $what_clan .
    "\nIf you were in another clan, why did you leave? " . $why_left .
    "\nWhat are your system specs? (CPU, RAM and Video card) " . $computer_specs;
    
    mail($address_to, $email_subject_line, $email_text, $address_from);
    
    header("Location:http://www.absoluteeliteclan.com/forums");
    
    ?>

  5. #5
    It gets better. Dynash has a brilliant futureDynash has a brilliant futureDynash has a brilliant futureDynash has a brilliant futureDynash has a brilliant futureDynash has a brilliant futureDynash has a brilliant futureDynash has a brilliant futureDynash has a brilliant futureDynash has a brilliant futureDynash has a brilliant future
    Join Date
    Jan 2008
    Location
    United Kingdom
    Posts
    4,531
    You can use the first one i gave you, and add that in according to that. Since that script is just an email script.
    JavaKrypt

    "If you think education is expensive. You should see the cost of ignorance."

  6. #6
    Junior Member Shemo is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    21
    Ok, I've got the upload function installed from the provided link:
    http://us2.php.net/features.file-upload

    I got the php processor all built and tested it..it works, but it shows the name of the picture and not the actual image.

    xhtml code for the form:
    Code:
    <!-- Upload Form -->
    <div style="margin-top: 15px; margin-right: auto; margin-bottom: 15px; margin-left: auto; color: #FFFFFF; text-align: center;">
    <form enctype="multipart/form-data name="upload_photos" action="upload_photos_complete.php" method="POST">
    <p>Name: <br />
    <input type="text" name="name" /></p>
    <p>State: <br />
    <input type="text" name="state" /><p>
    <p>Car Make: <br />
    <input type="text" name="make" /></p>
    <p>Car Model: <br />
    <input type="text" name="model" /></p>
    <p>How did you hear about us: <br />
    
    <input type="text" name="aboutus" /></p>
    <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
    <p>Upload: <br />
    <input name="upload" type="file" />
    <input type="submit" value="Upload File" /></p>
    <input type="submit" value="Submit" />
    &nbsp;
    <input type="reset" value="Reset" />
    </form>
    </div>

    Code:
    <?php
    
    $name = $_POST["name"];
    $state = $_POST["state"];
    $car_make = $_POST["make"];
    $car_model = $_POST["model"];
    $about_us = $_POST["aboutus"];
    $upload = $_POST["upload"];
    
    $address_to = "admin@ugly-cars.com ";
    $address_from = "From: upload@ugly-cars.com";
    $email_subject_line = $name . "'s file upload";
    
    $email_text = "Name:" . $name . 
    "\nState: " . $state .
    "\nCar Make: " . $car_make .
    "\nCar Model: " . $car_model .
    "\nHow did you hear about us:" . $about_us .
    "\nUploaded file: " . $upload;
    
    mail($address_to, $email_subject_line, $email_text, $address_from);
    
    header("Location:http://www.ugly-cars.com/test");
    
    ?>
    you can check out the form at:
    http://www.ugly-cars.com/test/upload.html

    is there a way to also make it so hitting upload file next to browse just uploads the photo to the email and not submit the form and the submit button actually submits the entire form?

Closed Thread

Similar Threads

  1. Replies: 0
    Last Post: February 5th, 2008, 03:42
  2. what is difference in function and @function in php
    By sunnyverma1984 in forum Programming Help
    Replies: 4
    Last Post: September 9th, 2007, 01:17
  3. Replies: 9
    Last Post: December 1st, 2006, 18:14
  4. Replies: 0
    Last Post: October 23rd, 2006, 18:13
  5. File Upload to Form and out to Email
    By jamieb100 in forum Programming Help
    Replies: 0
    Last Post: July 3rd, 2002, 09:35

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts