Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: upload file in php..

  1. #1
    Join Date
    Apr 2008
    Posts
    104
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default upload file in php..

    hey im searching for a php code to upload file system by user. I found some on internet but im including that upload file within Contact Us form so can i include that uploading thing within the Php page i already have to send email

  2. #2
    Join Date
    Apr 2009
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

  3. #3
    Join Date
    Apr 2008
    Posts
    104
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by borikenMedia View Post
    i cant figure it out.. any help?

  4. #4
    Join Date
    Apr 2009
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ur looking for a contact form with an attachment tool on it?
    to see if i can help u out.

  5. #5
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

  6. #6
    Join Date
    Apr 2008
    Posts
    104
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by borikenMedia View Post
    ur looking for a contact form with an attachment tool on it?
    to see if i can help u out.
    I already have contact form working just wanted to add attachment with it...

  7. #7
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    its not gonna be one line. use the code from that and modify your current file.

  8. #8
    Join Date
    Apr 2008
    Posts
    104
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by bluewalrus View Post
    its not gonna be one line. use the code from that and modify your current file.
    hmm never did this attachment before and i dont even want to mysql in this attachment here is the code in php and also tell me what to add in html file as well.

    PHP Code:
    if(isset($_POST['submit'])) {
    $to "email"
    $clientid "13001";
    $mail "1";
    $subject $_POST['subject'];
    $message $_POST['message'];
    $message1 $_POST['message1']; 
      
    $body "E-Mail: $mail\n Client Id: $clientid\n Comment:\n $message\n Suggestion:\n $message1"
      
    echo 
    "Email Sent";
    mail($to$subject$body"From: $mail");
    } else { 
    echo 
    "invalid!"

    Last edited by Snookerman; 04-21-2009 at 07:44 AM. Reason: added [php] tags

  9. #9
    Join Date
    Apr 2009
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    name the file as upfile.php
    HTML Code:
    <html>
    <body>
    <form enctype="multipart/form-data" action="upload_file.php" method="POST">
    <input type="hidden" name="MAX_FILE_SIZE" value="100000" />
    Choose a file to upload: <input name="uploadedfile" type="file" /><br />
    <input type="submit" value="Upload File" />
    </form>
    </body>
    </html>
    //name the file as upload_file.php
    PHP Code:
    <?php
    $target_path 
    "uploads/";
    echo 
    $target_path."<br>";

    $target_path $target_path basename$_FILES['uploadedfile']['name']); 

    if(
    move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
        echo 
    "The file ".  basename$_FILES['uploadedfile']['name']). 
        
    " has been uploaded";
    } else{
        echo 
    "There was an error uploading the file, please try again!";
    }
    ?>
    first you create a folder and name it as upload and this folder should be in the folder where the the above two programs is in ,and execute the program upfile.php

    bye
    Last edited by Snookerman; 04-21-2009 at 07:46 AM. Reason: added [html] and [php] tags

  10. #10
    Join Date
    Apr 2008
    Posts
    104
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    can I add this in my php code which i posted above

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
  •