Beginner PHP Tutorial – 87 – Uploading Files: The Basics

[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –


Posted

in

by

Tags:

Comments

46 responses to “Beginner PHP Tutorial – 87 – Uploading Files: The Basics”

  1. Thinuwan Imihira Avatar

    superrb boss. good work. i learned lot in a small time, thank you!!!!!!

  2. Irteza asad Avatar

    this was very helpful thank you!!!

  3. Cirlan Silvestru Avatar

    Hi,

    "Notice: Undefined index: file "

    I checked in php.ini and file_uploads is On !

    Someone can help me?

    Thanks!

  4. areh guano Avatar

    is the large image file unable to upload? example 7mb..

  5. Edward Leung Avatar

    how to you change the open php.ini file and set Fileupload :On on codeanywhere?

  6. IRGeekSauce Avatar

    Bucky, what happened to your voice? Lol. JK.

  7. Rafat Yusufi Avatar

    intresting, I like it

  8. Muhammad Ali Khalid Avatar

    Anyone Please Help Me I want to know that what is this Error: Undefined index file 🙁

  9. Omar NOUBAIR Avatar

    thanks so much helpfull =)

  10. Darwin Pose Avatar

    Your lesson is getting interesting 🙂

  11. Krypton Raven Avatar

    thx bro 😀 my project is fixed now :v thanks a lot :V

  12. Pc GamingHD Avatar

    osm and simple tutorial

  13. Aleksandar Djurdjevic Avatar

    this will fix your problem :
    echo @$name = $_FILES['file']['name'];

  14. Alyssa Harvey Avatar

    For anyone having problems I have posted a complete working gist of all the code (broen down into functions to keep it neat) covered in tutorials 87-91 including renaming uploaded files here:
    https://gist.github.com/aharvey3869/b474b6855c109c0f884b

  15. Alyssa Harvey Avatar

    If your not making it past the if(move_uploaded_file($tmp_name, $location.$name)){
    echo 'Success';
    } point make sure you already created the uploads folder. This will not create the directory for you.

  16. Nick Pangburn Avatar

    Does anyone know why when I upload a file to my webpage I cant do it again for some reason. It only works once per browser

  17. Ciaran Whyte Avatar

    You can use print_r($_FILES['file']); 
    If you wish to view all the keys/values of the associative array for the file.

  18. pedro delgado aparicio Avatar

    Thanks, I try the method "copy" using PDO, but it did not work, and when I using "move_uploaded_file" achieving work for me … so … Thanks! Again! 😀

  19. V. Peters Avatar

    <?php

    //@Krishna Kishore Modini, you missed a } but furthermore it helps get rid of the
    // undefined index yes.
    //@Antoan Popov you are missing some characters too { ?

    if(isset($_FILES['files'])){
        echo $_FILES['files']['name'];
    }

    ?>

    <form action="les87 uploading files.php" method="POST" enctype="multipart/form-data">
    <input type="file" name="file"><br><br>
    <input type="submit" value="Submit">

    </form>

  20. V. Peters Avatar

    undefined index line 2

  21. Mohd Nabeel Avatar

    Clearly explained. Nyce..

  22. X-Man 888 Avatar

    Great video! Thanks 🙂

  23. Brent Connor Avatar

    Good video, very informative. But, the first two minutes is pretty much ramble. Tutorial "starts" at 1:44 

  24. sam Khann Avatar

    (Y) good tutorial, but I got "Notice: Undefined index: file " on my upload.php

    Do you know why it displays this error? 

  25. Shuvro Jyoti Avatar

    Thanks Brother . 🙂

  26. Machine Gamer Avatar

    for those who having trouble with "if (move_uploaded_file($tmp_name, $location.$name))" move uploaded file ,i didn't see a small mistake that was giving me a problem with the function and it's that instead of putting a dot in "$location.$name" i actually put a coma "$location,$name" and notice that so check your code if u did the same mistake ,just an add maybe gonna some of u good luck !

  27. ja dls Avatar

    just put this
    error_reporting(0); in your php body

  28. Mustafa AbdurRaheem Avatar

    Can someone tell me why I keep getting the object not found error 404, im following along with apache, I do not how to upload the file or even transfer the fiel as Alex is doing, some please give advice.

  29. Antoan Popov Avatar

    Yeah i just randomly tried to define the variables below the iffset and i have no problem now.
    if(isset($_FILES['file']))
    { if(!empty($_FILES['file']))
    {
    $name = $_FILES['file']['name'];
    $size = $_FILES['file']['size'];
    $type = $_FILES['file']['type'];
    echo GOOD!'.$name.' '.$size.' '.$type
    }
    Good luck everybody!

  30. movie627 Avatar

    Notice: Undefined index: file in C:xampphtdocsWebsite2pagesFileUploadupload.php on line 2

    Notice: Undefined index: file in C:xampphtdocsWebsite2pagesFileUploadupload.php on line 3

    Notice: Undefined index: file in C:xampphtdocsWebsite2pagesFileUploadupload.php on line 4

    Notice: Undefined index: file in C:xampphtdocsWebsite2pagesFileUploadupload.php on line 6

  31. crank3yfrank3y Avatar

    Actually, not sure if this is correct, because when echoed out the 'tmp' directory used it reads /Applications/XAMPP/xamppfiles­/temp/.
    At some point, I had changed the permissions of folder /Applications/XAMPP and — more importantly — all the folders enclosed within /XAMPP. I think this is why /temp folder now allows all users to read-write (0777). And also why my PHP script is writing temporary files into that /temp folder.
    Apologies for confusion. No Mac gloating today; rather loathing.

  32. crank3yfrank3y Avatar

    XAMPP on Mac OSX 'Permission denied' and 'Unable to move' problem.
    To fix, must write 'tmp_name' to directory folder with less restrictive permissions. First, I went to 'Sites' folder and made new folder called 'temp'.
    Open /Applications/XAMPP/xamppfiles/etc/php.ini and look for a line which reads "upload_tmp_dir = /Applications/XAMPP/xamppfiles/temp/".
    Change this to reflect your path to new 'temp' folder. Mine now reads "upload_tmp_dir = /Sites/temp/" and I no longer get permission errors.

  33. gedq Avatar

    the sequencing on these is a mess.

  34. Krishna Kishore Modini Avatar

    if(isset($_FILES['files'])){
    echo $_FILES['files']['name'];

    ?>

    This will help you get without undefined index

  35. Maelas Avatar

    Hello, I very much appreciate your tutorials. They are very easy to understand for beginners like me. Im sure im not the only one. Keep it up!

  36. billy bob Avatar

    did you figure out what the problem was?

  37. Sunny Sood Avatar

    awesome vid brah. for those who get the notices. It is because you didnt specify the error reporting you wanted. thats probably in a much earlier vid near the beginning of the series. until you find it. put – error_reporting (E_ALL ^ E_NOTICE); at the start of your code and it should not show the notices you are seeing. it works for me so far and doesnt interfere with any other error reporting. If someone has a better idea, please share, I am a beginner after all.

  38. Matthew Cousins Avatar

    why did someone dislike????? great vids alex!

  39. ALI MUNTH Avatar

    @hohoyun i know right …

  40. TheTslat Avatar

    Mine doesn't work at all..As soon as the page loads it gives me an error saying that file is an undefined index, then when i upload the file itself, it just continuously loads, doing nothing

  41. Saqib Ahmed Avatar

    Please Upload the tutorial to how to give a download link on our webpage from our database.

  42. hohoyun Avatar

    this upload series should come before tutorial 84

Leave a Reply

Your email address will not be published. Required fields are marked *