Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22

Thread: upload file in php..

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

    Default

    hai

    the main goal is to upload the file ,for that purpose it is enough to use my code.but i cant understood your problem. do you want to upload the contactus page?

    then by executing upfile.php you should browse the location of contactus page.

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

    Default

    hai,

    I cant understood ur problem


    the main goal is to uplaod file.for that purpose it is enough to use my code .
    first executing the upfile.php from that you can browse the contactus page

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

    Default

    I have a CONTACT US PAGE... which uses PHP TO send EMAIL to me, i want to add an UPLOAD FILE field WITHIN THAT PHP file THAT im already using... do you understand now?

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

    Default

    then please put the action from contactus page to upfile.php
    or
    you can also use the code with in contactus page by using include("upfile.php");
    or
    do you want to insert that code into your contactus page then copy the code and put in contactus page and use the text field names same means i used uploadedfile in upfile.php and it occurs 3 times in upload_file.php.if u want to change it then replace it in 3places.
    Last edited by ganu; 04-20-2009 at 12:50 PM.

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

    Default

    hi i made this now and its not uploading..
    PHP Code:
    if(isset($_POST['submit'])) {
    $target_path "uploads/";
    echo 
    $target_path."<br>";
    $target_path $target_path basename$_FILES['uploadedfile']['name']); 
    $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:48 AM. Reason: added [php] tags

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

    Default

    Quote Originally Posted by ganu View Post
    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
    Your program does not work well, I tried it and its not uploading and giving erorr that please try again..
    Last edited by Snookerman; 04-21-2009 at 07:50 AM. Reason: added [html] and [php] tags in quote

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

    Default

    please can anyone help me in this? i tried other scripts as well and no one is working..

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

    Default

    bump...

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

    Default

    hey you put in action in the form tag to upload_file.php

    i specied above action="upfile.php " not to upload_file.php in contactus.php

    <form enctype="multipart/form-data" action="upload_file.php" method="POST">

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

    Default

    Quote Originally Posted by ganu View Post
    hey you put in action in the form tag to upload_file.php

    i specied above action="upfile.php " not to upload_file.php in contactus.php

    <form enctype="multipart/form-data" action="upload_file.php" method="POST">
    Ive tried the exact code that you have given me before.. that is not working either.. what could be wrong?

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
  •