Results 1 to 3 of 3

Thread: Users not allowed to upload files on my free hosting for my web site?

  1. #1
    Join Date
    Dec 2009
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Users not allowed to upload files on my free hosting for my web site?

    im trying to learn php.
    so ive been trying out code i found on w3schools.com, to see exactly how it works
    everything has worked so far
    but i got to the chapter about users uploading files, copied and pasted the code, tried it out, it seemed to be working, but i was unable to find the file on the server once it was uploaded
    i suspect that the free hosting service that i am using is blocking my ability to allow the users to upload files.

    is this possible?

    once the submit button is pressed, there is even a confirmation message telling the user where the file is stored, and it appears, but the file cant be found in my ftp program or in cpanel

    if anyone knows a free web hosting service that definitely does not **** with what php is allowed to do, i would like to know. if they have messed with this aspect of php, then who knows what else theyve ****ed with. this is frustrating, its making me think that i have made a mistake when i have not, and i am wasting my time looking for mistakes that do not exist





    FOR REFERENCE here is my code, but i am almost certain that it is correct




    helloworld.php:

    Code:
    <html>
    <body>
    
    <form action="upload_file.php" method="post"
    enctype="multipart/form-data">
    <label for="file">Filename:</label>
    <input type="file" name="file" id="file" />
    <br />
    <input type="submit" name="submit" value="Submit" />
    </form>
    
    </body>
    </html>



    upload_file.php:

    Code:
    <?php
      if ($_FILES["file"]["error"] > 0)
        {
        echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
        }
      else
        {
        echo "Upload: " . $_FILES["file"]["name"] . "<br />";
        echo "Type: " . $_FILES["file"]["type"] . "<br />";
        echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
        echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";
    
        if (file_exists("upload/" . $_FILES["file"]["name"]))
          {
          echo $_FILES["file"]["name"] . " already exists. ";
          }
        else
          {
          move_uploaded_file($_FILES["file"]["tmp_name"],
          "upload/" . $_FILES["file"]["name"]);
          echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
          }
        }
    ?>

  2. #2
    Join Date
    Dec 2009
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    i fixed the problem, it was folder permissions

  3. #3
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 517 Times in 503 Posts
    Blog Entries
    5

    Default

    I wouldn't be so upset about any restrictions your *free* web host may have made on how much PHP functionality is available to you.

    As for finding your problems, yes, that can be frustrating. Folder permissions, for example, are rarely covered in tutorials. When they are mentioned, it's usually vague and easily overlook-able. When you figure it out, it's kinda like realizing you computer won't turn on because -duh- it's not plugged in.

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
  •