PHP File Uploading

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 พ.ย. 2024

ความคิดเห็น • 126

  • @Dani_Krossing
    @Dani_Krossing 9 ปีที่แล้ว +29

    This is the first TH-cam tutorial on file upload I have found which actually makes sense. Thanks

    • @AhmadRaza-wi7sy
      @AhmadRaza-wi7sy 3 ปีที่แล้ว

      aaaareeey chlaaey niii sady haan tee we zalim ah

    • @KM-sf6zy
      @KM-sf6zy 3 ปีที่แล้ว

      so is yours too, your videos helps me a lot on learning php specially the mvc one.

  • @devlinthornicroft9975
    @devlinthornicroft9975 10 ปีที่แล้ว +2

    Works great. Thanks Alex and PHP Academy. Seems like almost every video you guys post is easy to follow and actually works.

  • @embersajt2593
    @embersajt2593 5 ปีที่แล้ว +1

    FInally somebody explained us how to do this! Thank you very much for this!
    For those people who's project is not working properly, please make sure you setted the next permission on the "uploads/" folder on linux. (chmod 0777 uploads/) It allowes your site to create files into the folder.

    • @yuan3234
      @yuan3234 4 ปีที่แล้ว

      Yow bro thanks alot !!

    • @nanaparker_
      @nanaparker_ 2 ปีที่แล้ว

      Thanks a lot! This was really helpful

  • @NDHFilms
    @NDHFilms 4 ปีที่แล้ว

    Here's a little thing that tripped me up: when you're testing it out, make sure you are loading your pages from the server, and not from your computer's file directory. If you are opening the files locally, when you click the 'upload' button, it is going to open the php file, and just show you the code you wrote.
    If you are using Windows, you'll want the url to start with localhost, not C/Program%20Files or something similar.

  • @trakeshkumar
    @trakeshkumar 6 ปีที่แล้ว

    thanks bro...out of all youtube videos for file uploading only this one worked thanks a lot

  • @rodrickngonyoku5042
    @rodrickngonyoku5042 4 ปีที่แล้ว

    Bravo.!!..just bravo!!!...simple,short,brief and informative...Thank You Very Very Much!!!

  • @mrigankpawagi
    @mrigankpawagi 7 ปีที่แล้ว +2

    Thanks a lot man!!! No online tutorial was helping me, but you! Thanks a lot!

  • @dXXPacmanXXb
    @dXXPacmanXXb 9 ปีที่แล้ว

    Is it possible to upload a file via a string that was given to the script per POST-Method?
    So like the post-info "file" is "C:/.../file.txt" and then the file file.txt gets uploaded. So that I don't have to use a file browser but just copy the directory as a string in a form for example?

  • @dxb_coder
    @dxb_coder 6 ปีที่แล้ว

    Best file uploading tutorial so far....thanx

  • @ZacharyBeers
    @ZacharyBeers 10 ปีที่แล้ว +1

    this was a lot easier than i was expecting, thanks!

  • @lfoxforl3232
    @lfoxforl3232 9 ปีที่แล้ว +9

    So u can upload files in ur local website folder...but is there a way u can upload a file into a folder on a online host like *awardspace?

  • @MarkGoldfain
    @MarkGoldfain 3 ปีที่แล้ว

    Beautifully presented. Thanks!

  • @mohammedjammeh3299
    @mohammedjammeh3299 7 ปีที่แล้ว

    Thank you very very much for these tutorials. You've been saving my life for the past couple of days.

  • @007KrausBean
    @007KrausBean 10 ปีที่แล้ว

    Awesome. I'm trying to learn about loading images to a MySQL database into as a BLOB and then recalling it to a page from the Database. Do you have a video about that? If so, I have not found it yet.

  • @kabrau08
    @kabrau08 9 ปีที่แล้ว +1

    Thank you very much, you are a great instructor. Sorry for my English.

  • @heriblandt
    @heriblandt 8 ปีที่แล้ว

    I have used this video to make an upload project but for mp3's however that seems really unstable, even after I have added quite a few different mp3-types to the array. Any suggestions? For now I work in localhost

  • @_romeopeter
    @_romeopeter 6 ปีที่แล้ว

    Thank you so much for this, this makes so much sense, keep making good and understandable videos like this!

  • @YanneckMeyer
    @YanneckMeyer 7 ปีที่แล้ว

    Great Tutorial! Thank you. Finally I created my script, connected with a lot of inputs. Works so great together :)

  • @wadwdaaafefawfawawfawerog4335
    @wadwdaaafefawfawawfawerog4335 7 ปีที่แล้ว

    but what if 2 ppl upload a file with the same name EXACTLY at the same time.. wont it break and overwright one of the files.

  • @lifeonearth9490
    @lifeonearth9490 4 ปีที่แล้ว

    Dear Sir, thank you for sharing.May I know where the uploaded files will be saved?If there are many files from the public, the space may be full on our PC.

  • @brprelude2012
    @brprelude2012 10 ปีที่แล้ว

    maybe I didn't see this but are the only extensions allowed txt and jpg?

  • @emmanuelalfred354
    @emmanuelalfred354 7 ปีที่แล้ว

    you just earned yourself a new follower. Awesome overall

  • @lars_vs
    @lars_vs 9 ปีที่แล้ว

    great video, actually sticks to the point

  • @gustavowalteroslarrotta7798
    @gustavowalteroslarrotta7798 7 ปีที่แล้ว

    thanks, good work, form the other side of the planet, i only speak spanish but i can undertand your method, thanks friend.

  • @slidejones6033
    @slidejones6033 5 ปีที่แล้ว

    So clear and easy to understand. Thanks

  • @KN0CK0UT91
    @KN0CK0UT91 9 ปีที่แล้ว +2

    this is just amazing man. totally works. Thanks THANKs... THANKKSSSSSS

  • @GePree00
    @GePree00 9 ปีที่แล้ว

    thank you! Very easy to follow and works like a charm!

  • @adamfay940
    @adamfay940 7 ปีที่แล้ว

    Thanks for the help, the only video I could find that helped me.

  • @shreyaraj7brollno.286
    @shreyaraj7brollno.286 9 ปีที่แล้ว

    You are great my lord! You are so amazing man.

  • @espheroz
    @espheroz 8 ปีที่แล้ว

    i can see it in the folder on bracket software but there is nothing on the desktop folder please help

  • @AnotherKentPaul
    @AnotherKentPaul 9 ปีที่แล้ว

    Why is there no filesize when uploading a jpg or png file? The size array always says 0?

    • @BillBodkin
      @BillBodkin 9 ปีที่แล้ว

      +AnotherKentPaul same, and my file wont upload

  • @Eddygeek18
    @Eddygeek18 10 ปีที่แล้ว

    Just tried it and it's returning the $file_name_new as .txttxt?
    EDIT: Never mind realised i was still using print_r($file_ext); underneath the code.

    • @thoughtyness
      @thoughtyness 8 ปีที่แล้ว

      Haha! Same thing happened to me.

  • @illeone5433
    @illeone5433 3 ปีที่แล้ว

    Thank you very much for the tutorial, very helpful.

  • @frknens0
    @frknens0 3 ปีที่แล้ว

    How can I find out path of the selected file?

  • @kaunas163
    @kaunas163 8 ปีที่แล้ว

    excellent tutorial, keep the good work!

  • @FestusMuberuka
    @FestusMuberuka 8 ปีที่แล้ว

    That Ending Though

  • @BlaBlah000
    @BlaBlah000 8 ปีที่แล้ว

    does this work locally for example with WAMP, or only when files are uploaded to the server.

  • @anirbanchakraborty690
    @anirbanchakraborty690 8 ปีที่แล้ว

    awesome video, very informative .

  • @teamunicornproductions.5825
    @teamunicornproductions.5825 9 ปีที่แล้ว

    sir do you have a download video ?

  • @sjarreldevis6406
    @sjarreldevis6406 8 ปีที่แล้ว

    Awesome tutorial! What if i want to upload PDF files? Thanks!

  • @jasonivanpaguio8633
    @jasonivanpaguio8633 6 ปีที่แล้ว

    Works locally but i needed to upload to my hosting server and it doesnt allow me to please help

  • @TRchotbal
    @TRchotbal 7 ปีที่แล้ว

    Oh no no no noo. The tutorial is pretty good, but checking the ext can pretty much f the whole system up. I recommend checking the MIME type instead (and google to find more security uploadings with php as well). If not then anyone can change uploading file types i.e. myPdf.pdf to myPdf.jpg and wolaaa, it gets uploaded.
    Also I recommend using the uniqid(mt_rand(), true). Otherwise a good and helpful tutorial.

  • @DANJUMA9
    @DANJUMA9 10 ปีที่แล้ว

    How would you do this via OOP?

  • @benttoenail
    @benttoenail 9 ปีที่แล้ว

    Beautiful - thanks for the info

  • @andrehideki859
    @andrehideki859 6 ปีที่แล้ว

    Thank you. This video was very useful.

  • @mnageh-bo1mm
    @mnageh-bo1mm 4 ปีที่แล้ว

    any idea how to send a post request to upload.php and got it to save it ?

  • @johnelias8976
    @johnelias8976 7 ปีที่แล้ว

    Notice: Undefined variable: files in /storage/ssd2/642/2185642/public_html/upload.php on line 4

  • @dharakhorasiya4704
    @dharakhorasiya4704 6 ปีที่แล้ว

    Excellent tutorial

  • @tagKnife
    @tagKnife 10 ปีที่แล้ว +4

    Too many unneeded variables. once you copy $_FILES['file'] to $file Using the $file array is enough you dont need to assign more variables...
    This would be a good time to make a video about references/pointers

    • @codecourse
      @codecourse  10 ปีที่แล้ว +3

      Thanks for the comment, it just made things clearer and if they're required again they would be useful - but you're right, in this example they're not absolutely required.

  • @ahmelq
    @ahmelq 10 ปีที่แล้ว

    Hey alex , i don't think this work on mobiles !

  • @lulu-xd3lg
    @lulu-xd3lg 7 ปีที่แล้ว

    nice and concise

  • @TheGauravmankar
    @TheGauravmankar 10 ปีที่แล้ว +2

    You are awesome

  • @japjap6406
    @japjap6406 8 ปีที่แล้ว

    do you have a tutorial for an image only ?

    • @석순달
      @석순달 7 ปีที่แล้ว

      Nookummoogliepums Smoochiedumpling

  • @wazihsabir8740
    @wazihsabir8740 8 ปีที่แล้ว

    Thank you so much dude!! You are so fucking smart!

  • @shivshankar654
    @shivshankar654 6 ปีที่แล้ว

    can we upload the file without temporary file

  • @EldanShkolnikov
    @EldanShkolnikov 9 ปีที่แล้ว

    Great Tutorial. Thank you!

  • @gouripattar403
    @gouripattar403 6 ปีที่แล้ว

    But it is showing undefined index : tmp_name

  • @tsigilis
    @tsigilis 10 ปีที่แล้ว +1

    what server do you use?

    • @pathros425
      @pathros425 9 ปีที่แล้ว +1

      +Αλέξανδρος Τσιγγίλης In min 3:31 you can read it: MAMP. But later on Alex made a video about Laravel's homestead.

  • @DoorsExciteMe
    @DoorsExciteMe 9 ปีที่แล้ว

    Fantastic, thanks!

  • @jetongjonbalaj972
    @jetongjonbalaj972 6 ปีที่แล้ว

    Does this work on online servers?

  • @MrLinusunil
    @MrLinusunil 7 ปีที่แล้ว

    Worked, thanks!

  • @japjap6406
    @japjap6406 8 ปีที่แล้ว

    how it will save in the xampp

  • @kayoutube690
    @kayoutube690 8 ปีที่แล้ว

    Hi Sir Alex, could you please do sample tutorial in php, like login authentication if the user fail to login 3 times the users were going to ban.thank you .

    • @Hoogleyboogleynetwork
      @Hoogleyboogleynetwork 7 ปีที่แล้ว

      This is fairly easy to do, I'm assuming you know how to use the PHP insert and mysql_query feature. How I do this is I make a database table called "login attempts" to store every login attempt. You can do PHP to select data from there and compare them using mysql_num_rows and see if there are 3 for a specific user. Sorry if this was confusing.

  • @francispauloguillermo9241
    @francispauloguillermo9241 7 ปีที่แล้ว

    Thank you it helped me a lot

  • @UrbanKhalifah
    @UrbanKhalifah 10 ปีที่แล้ว +1

    very informative, thank you =]

  • @hassankhalid2520
    @hassankhalid2520 8 ปีที่แล้ว

    Great Demonstration (Y)

  • @wickedsnuk3812
    @wickedsnuk3812 6 ปีที่แล้ว +1

    I would marry you if I was a woman.
    Thank you so fckng much !! you are nuts !

  • @ALIMUNTH
    @ALIMUNTH 10 ปีที่แล้ว

    SAME ALEX from 2 years a go :)

  • @cyrusplaton9824
    @cyrusplaton9824 7 ปีที่แล้ว

    move_uploaded_file() expects parameter 1 to be string, array given in C:\xampp\htdocs\arms\upload.php on line 30
    i have this error. help please :(

  • @emmanueleden1930
    @emmanueleden1930 9 ปีที่แล้ว

    this doesnt work for me when i add mp3 or mp4. i dont know why :(

    • @nookummoogliepumssmoochied7458
      @nookummoogliepumssmoochied7458 8 ปีที่แล้ว

      +emmanuel eden
      have you tried adding these file types here?
      $allowed= array('txt', 'jpg', 'pdf', 'doc');

  • @AzizjanAyupov_leo
    @AzizjanAyupov_leo 9 ปีที่แล้ว

    Please hepl me!
    I need to write video uploader script. How I can do it?

    • @RomeWithTheHEMIs
      @RomeWithTheHEMIs 9 ปีที่แล้ว +1

      +Azizjan Ayupov This is what you need for uploading videos. Perhaps, you're talking about streaming them. Look for a tutorial on that, if so.

    • @AzizjanAyupov_leo
      @AzizjanAyupov_leo 9 ปีที่แล้ว

      Jerome Carter thank you, friend! I already had done it)

  • @hiaQadeer
    @hiaQadeer 7 ปีที่แล้ว

    Thank you, it was interesting.

  • @TOminerTV
    @TOminerTV 7 ปีที่แล้ว

    The last if construct does not work, no error message no output, no upload, nothing!

  • @japjap6406
    @japjap6406 8 ปีที่แล้ว

    is this not vulnerable for double extension ? name.php.txt ? or something ?is this safe enough for a website ?

    • @searchbarwebs
      @searchbarwebs 8 ปีที่แล้ว +2

      Indeed. This is NOT secure for production/live/testing websites. i repeat. DO NOT USE IT!!!

    • @japjap6406
      @japjap6406 8 ปีที่แล้ว

      +Sam Host can you explain me why ? in detailed thanks

    • @engineeringjoe
      @engineeringjoe 8 ปีที่แล้ว

      +Sam Host why ?

    • @searchbarwebs
      @searchbarwebs 8 ปีที่แล้ว

      security.stackexchange.com/questions/32852/risks-of-a-php-image-upload-form

    • @kluftdeko8513
      @kluftdeko8513 7 ปีที่แล้ว +2

      I think its not vulnerable for double extension because he is splitting the filename into a array. He is using as split the "." and he will get a array. If u take "name.php.txt" you will get a array with "name|php|txt". He is taking the last element of the array for the extension wich will be correct in this case. I cant think about a case where this wont work.

  • @aviC137
    @aviC137 8 ปีที่แล้ว

    Thank you!

  • @sanchitapaul2823
    @sanchitapaul2823 6 ปีที่แล้ว

    it will be helpful if you add source code link :)

  • @andyjohn907
    @andyjohn907 4 ปีที่แล้ว

    thanks it worked for me..

  • @EloyFernandes91
    @EloyFernandes91 10 ปีที่แล้ว

    If you upload a jpg file, how can you show it like if you upload a facebook photo?

    • @EddieNotFound1
      @EddieNotFound1 10 ปีที่แล้ว

      Just print out the location of the file inside an HTML img tag, you still need to wait for the file to be uploaded in order to do this, or you can also use AJAX for make it look better. You can archieve this in the client using any HTML5 feature too but that could a bit more advanced.

  • @KushalLuitel
    @KushalLuitel 9 ปีที่แล้ว

    i tried it for mp3 nothing happened. please help me out

    • @johnreeves2435
      @johnreeves2435 8 ปีที่แล้ว

      +Kushal Luitel a bit late of a reply, but did you ever figure out how to upload mp3s?

    • @johnreeves2435
      @johnreeves2435 8 ปีที่แล้ว

      +John Reeves I'm replying to myself here, but the issue ended up being that the maximum upload size was limited to 2MB by my php.ini file. I raised it, and then my mp3s went through to the uploads folder. Make sure you restart apache/your server so that the changes to php.ini take effect.

    • @KushalLuitel
      @KushalLuitel 8 ปีที่แล้ว +1

      +John Reeves thanks I'll try it

  • @websiteprogrammer7307
    @websiteprogrammer7307 7 ปีที่แล้ว

    Checkout how to upload a specific type of file from my html document

  • @ǿǿřǿ-j6z
    @ǿǿřǿ-j6z 5 ปีที่แล้ว

    thanq

  • @aramsadoyan5233
    @aramsadoyan5233 9 ปีที่แล้ว

    heeeeeeeeeeY!!!!!!1 where are your - choose file button in source???
    ...ilusianist

  • @Trambulhao
    @Trambulhao 10 ปีที่แล้ว +1

    Alternative: $ext = pathinfo($file_name, PATHINFO_EXTENSION);

  • @ImpulseYou
    @ImpulseYou 7 ปีที่แล้ว

    thx !

  • @gregs6178
    @gregs6178 8 ปีที่แล้ว

    Everything works except moving the file to the server's directory!!!

    • @danielsomoghi7493
      @danielsomoghi7493 8 ปีที่แล้ว

      that might be because you do not have read & write permission for that folder. Assuming you are testing all this out in your local machine using XAMPP or WAMPP, (on windows) you can select the folder you are trying to move the file to, right click it, go to the Security tab and enable permissions for all users. (on Mac) right click on the desired folder, Get info, select everyone at the bottom, double click on "everyone" and select "Read & Write". I reckon on a domain all the privileges are set by default to read and write but I might be wrong. Hope this helped :) cheers

    • @gregs6178
      @gregs6178 8 ปีที่แล้ว

      that was the problem. I'm using apache web server via ubuntu. I changed the directory permissions and was able to post.

  • @giangphan9291
    @giangphan9291 9 ปีที่แล้ว

    thank you :v

  • @Jattonroax
    @Jattonroax 6 ปีที่แล้ว

    what the fuck is tmp_name

  • @aliaalea117
    @aliaalea117 7 ปีที่แล้ว

    ah ribet banget, ane jga bisa ayo berteman Fb facebook.com/caberawit78

  • @bryallen11
    @bryallen11 7 ปีที่แล้ว +1

    Nice voice and accent! Not a tutorial for beginners. Way too much mumbo jumbo for people who want to learn a basic file upload in php. Overall, bad! The essence of teaching something is starting from the premise that the people who are learning from you have no idea what they're doing. It takes a skilled educator to move slowly through and explain in a deliberate manner as if talking to a child because that's where learners are at, they are at a childlike state. What would have been constructive is to start from basic file upload and then in subsequent tutorials to add things like file ext and size checking.

    • @kluftdeko8513
      @kluftdeko8513 7 ปีที่แล้ว +5

      I think it is the easiest way he can tell us as spectators how a file transfer script is working. Iam a beginner in php too and i could understand it easily.