How to Upload Files Using PHP

Поділитися
Вставка
  • Опубліковано 12 лис 2024

КОМЕНТАРІ • 11

  • @kakapasoknabalita
    @kakapasoknabalita 10 років тому

    Thanks for this tutorial John..Appreciated.

  • @tikarobinson9335
    @tikarobinson9335 8 років тому

    thank you so much, you explain things way better than my teacher, you are a big help thanx

    • @john.morris
      @john.morris  8 років тому

      +tika “tikarobinson” robinson no problem!

  • @aramishannibal3749
    @aramishannibal3749 9 років тому

    How do you save this file to a database? John Morris

  • @olekristianmller-hansen4220
    @olekristianmller-hansen4220 7 років тому

    move_uploaded_file seems to allways return false, and when I look in the uploads folder, it is indeed empty.
    My code should not differ from the code in the video.
    $targetPath = "uploads/";
    $targetPath = $targetPath . basename($_FILES['uploadedfile']['name']);
    if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $targetPath)) {
    echo 'The file ' . basename($_FILES['uploadedfile']['name']) . ' has been uploaded.';
    } else {
    echo 'There was an error uploading the file, please try again.';
    }

    • @olekristianmller-hansen4220
      @olekristianmller-hansen4220 7 років тому

      I have turned on error reporting, and I get a warning saying
      Permission denied in /usr/home/ole/html/uploader.php.
      I am logged in on the owner of the folder and it's rights are as follows: rwxr-xr-x
      Can it have anything to do with the fact theat I am creating the PHP files and upload
      folder on my own personal PC and then moving it over to the web server?

    • @curtturdle5661
      @curtturdle5661 7 років тому +2

      it's file permissions. i have the same problem and none of these videos even talk about the subject.

    • @olekristianmller-hansen4220
      @olekristianmller-hansen4220 7 років тому

      You are right. I thought I had to log on to an account in Ubuntu with sufficient permissions and then run PHP from there, but it appears as if *Apache 2 and PHP creates their own accounts*.
      Apache: _www-data_
      PHP: _www_
      This explains the issue, as in my case; only the owner [ole] has write-permissions!

  • @dastgirakhtar9782
    @dastgirakhtar9782 7 років тому

    sir you are great!

  • @maxagent9463
    @maxagent9463 11 років тому +1

    thank you for this :)