Problem With Upload Script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Instead of making php.ini you can make .htaccess.
    Ask your host to enable changing php values via .htaccess

    ---------------------------
    Thanks wappy for teaching me that lol[/b]

    i have got .htaccess already, i see it on my main dir

    Comment


      #17
      put this in ua .htaccess file to make register globals on :-
      Code:
      php_value register_globals 1
      And this script looks weird to me ... how u wud use case for errors ?? nd wht if user has not selected any file wht wud be error ?
      <span style="font-size:12pt;line-height:100%"><span style="color:#FF0000">ViSiT Ma SiTe Nd PoSt Ua CoMmEnTs On It In Ma PoSt</span></span>

      Comment


        #18
        ok this is whats in my .htaccess

        Code:
        # -FrontPage-
        
        Options None
        
        <Limit GET POST>
        order deny,allow
        deny from all
        allow from all
        require group authors administrators
        </Limit>
        <Limit PUT DELETE>
        order deny,allow
        deny from all
        </Limit>
        AuthType Basic
        AuthName synergyx.co.za
        AuthUserFile /home/synergyx/public_html/_vti_pvt/service.pwd
        AuthGroupFile /home/synergyx/public_html/_vti_pvt/service.grp
        what do i change?

        Comment


          #19
          Jst add this line :-
          Code:
          php_value register_globals 1
          like this :-
          ok this is whats in my .htaccess

          Code:
          # -FrontPage-
          
          Options None
          
          <Limit GET POST>
          order deny,allow
          deny from all
          allow from all
          require group authors administrators
          </Limit>
          <Limit PUT DELETE>
          order deny,allow
          deny from all
          </Limit>
          AuthType Basic
          AuthName synergyx.co.za
          AuthUserFile /home/synergyx/public_html/_vti_pvt/service.pwd
          AuthGroupFile /home/synergyx/public_html/_vti_pvt/service.grp
          php_value register_globals 1
          [/b]
          <span style="font-size:12pt;line-height:100%"><span style="color:#FF0000">ViSiT Ma SiTe Nd PoSt Ua CoMmEnTs On It In Ma PoSt</span></span>

          Comment


            #20
            ok i have done all of this and still the upload script doesnt work, is my script wrong? my .htaccess has been edited and i have spoken to my host and they said i must do the exact same thing, but my luck its still not working

            Comment


              #21
              firstly i created a simple upload script called upload.php, with the following code
              Code:
              <html>
              <head>
              <title>File Upload Form</title>
              </head>
              <body>
              This form allows you to upload a file to the server.
              
              
              <form action="getfile.php" method="post">
              
              Type (or select) Filename: <input type="file" name="uploadFile">
              <input type="hidden" name="MAX_FILE_SIZE" value="25000" />
              <input type="submit" value="Upload File">
              </form>
              
              </body>
              </html>
              then i created a getfile script called getfile.php, with following code
              Code:
              <html>
              <head>
              <title>Process Uploaded File</title>
              </head>
              <body>
              <?php
              
              if ( move_uploaded_file ($_FILES[&#39;uploadFile&#39;] [&#39;tmp_name&#39;], 
                     "../uploads/{$_FILES[&#39;uploadFile&#39;] [&#39;name&#39;]}")  )
                    {  print &#39;
              
               The file has been successfully uploaded </p>&#39;;
                     }
              else
                    { 
                      switch ($_FILES[&#39;uploadFile&#39;] [&#39;error&#39;])
                       {  case 1:
                                 print &#39;
              
               The file is bigger than this PHP installation allows</p>&#39;;
                                 break;
                          case 2:
                                 print &#39;
              
               The file is bigger than this form allows</p>&#39;;
                                 break;
                          case 3:
                                 print &#39;
              
               Only part of the file was uploaded</p>&#39;;
                                 break;
                          case 4:
                                 print &#39;
              
               No file was uploaded</p>&#39;;
                                 break;
                       }
                     }
              
              ?>
              </body>
              </html>
              nothing happens, i tested it and nothing uploads!!!! whats the problem?[/b]

              Ermm bro u have some syntax error in ur xhtml form..
              That is when u use <form action="getfile.php" method="post"> only, the default value is taken for enctype attribute... default value of the enctype attribute is "application/x-www-form-urlencoded".

              So wen ur using a form for file upload u have to change the enctype to "multipart/form-data"..

              So above code should be changed as

              <form action="getfile.php" method="post" enctype="multipart/form-data">

              Try this and see...

              Comment

              Working...
              X