Need a Help with Form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • srockhard
    Retired
    • Jul 2011
    • 1976

    #1

    Need a Help with Form

    My form works great but I can't get the user submitted images to save to my server or display in the email that I receive once form is submitted. What is wrong here:

    Code:
        $allowed_extensions = array("jpg", "jpeg", "gif", "bmp", "png");
    
        //Get the uploaded file information
    
        $name_of_uploaded_file =  basename($_FILES['photo']['name']);
    
        //get the file extension of the file
    
        $type_of_uploaded_file = substr($name_of_uploaded_file, strrpos($name_of_uploaded_file, '.') + 1);
    
        $size_of_uploaded_file = $_FILES["photo"]["size"]/1024;//size in KBs     
    
         //copy the temp. uploaded file to uploads folder
    
        $path_of_uploaded_file = $_SERVER['DOCUMENT_ROOT'] .'/' . $name_of_uploaded_file;
    
        $tmp_path = $_FILES["photo"]["tmp_name"];
    
        if(is_uploaded_file($tmp_path))
    
        {
    
          if(!copy($tmp_path,$path_of_uploaded_file))
    
          {
    
            $errors .= '\n error while copying the uploaded file';
    
          }
    
        }
    Piper Pines
  • fendlestick
    Confirmed User
    • Dec 2012
    • 117

    #2
    Didnt read the code, but maybe the issue is with your upload folder permissions as they always sux.

    Comment

    • AMSM

      #3
      double check the words 'photo' 'name' and 'size' are the same words as in the html on the front end form, that usually gets me.

      Comment

      • nin
        Confirmed User
        • Aug 2013
        • 68

        #4
        do not try to check all the code, find the place where you loose your file -

        from the begining:
        die($name_of_uploaded_file); will give you the name of the file or you are not receiving it on the server at all?

        if you have the file - try to use "move_uploaded_file"

        include all the checkings, renamings, filters only after you will solve the main problem - getting your file in the place it should appear.

        Comment

        Working...