PHP File Uploading

Поделиться
HTML-код
  • Опубликовано: 25 окт 2024

Комментарии • 126

  • @Dani_Krossing
    @Dani_Krossing 9 лет назад +29

    This is the first RUclips 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.

  • @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.

  • @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

  • @trakeshkumar
    @trakeshkumar 6 лет назад

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

  • @mrigankpawagi
    @mrigankpawagi 7 лет назад +2

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

  • @rodrickngonyoku5042
    @rodrickngonyoku5042 4 года назад

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

  • @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?

  • @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!

  • @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.

  • @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?

  • @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.

  • @_romeopeter
    @_romeopeter 6 лет назад

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

  • @emmanuelalfred354
    @emmanuelalfred354 7 лет назад

    you just earned yourself a new follower. Awesome overall

  • @KN0CK0UT91
    @KN0CK0UT91 9 лет назад +2

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

  • @slidejones6033
    @slidejones6033 5 лет назад

    So clear and easy to understand. Thanks

  • @YanneckMeyer
    @YanneckMeyer 7 лет назад

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

  • @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

  • @FestusMuberuka
    @FestusMuberuka 8 лет назад

    That Ending Though

  • @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.

  • @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.

  • @GePree00
    @GePree00 9 лет назад

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

  • @espheroz
    @espheroz 8 лет назад

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

  • @lars_vs
    @lars_vs 9 лет назад

    great video, actually sticks to the point

  • @kabrau08
    @kabrau08 9 лет назад +1

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

  • @adamfay940
    @adamfay940 6 лет назад

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

  • @brprelude2012
    @brprelude2012 10 лет назад

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

  • @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.

  • @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

  • @kaunas163
    @kaunas163 8 лет назад

    excellent tutorial, keep the good work!

  • @shreyaraj7brollno.286
    @shreyaraj7brollno.286 9 лет назад

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

  • @johnelias8976
    @johnelias8976 7 лет назад

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

  • @frknens0
    @frknens0 3 года назад

    How can I find out path of the selected file?

  • @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.

  • @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.

  • @illeone5433
    @illeone5433 3 года назад

    Thank you very much for the tutorial, very helpful.

  • @andrehideki859
    @andrehideki859 6 лет назад

    Thank you. This video was very useful.

  • @TOminerTV
    @TOminerTV 7 лет назад

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

  • @anirbanchakraborty690
    @anirbanchakraborty690 8 лет назад

    awesome video, very informative .

  • @jasonivanpaguio8633
    @jasonivanpaguio8633 6 лет назад

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

  • @EldanShkolnikov
    @EldanShkolnikov 9 лет назад

    Great Tutorial. Thank you!

  • @benttoenail
    @benttoenail 9 лет назад

    Beautiful - thanks for the info

  • @dharakhorasiya4704
    @dharakhorasiya4704 6 лет назад

    Excellent tutorial

  • @mnageh-bo1mm
    @mnageh-bo1mm 4 года назад

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

  • @ahmelq
    @ahmelq 10 лет назад

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

  • @gouripattar403
    @gouripattar403 6 лет назад

    But it is showing undefined index : tmp_name

  • @japjap6406
    @japjap6406 8 лет назад

    do you have a tutorial for an image only ?

    • @석순달
      @석순달 7 лет назад

      Nookummoogliepums Smoochiedumpling

  • @teamunicornproductions.5825
    @teamunicornproductions.5825 9 лет назад

    sir do you have a download video ?

  • @DANJUMA9
    @DANJUMA9 10 лет назад

    How would you do this via OOP?

  • @francispauloguillermo9241
    @francispauloguillermo9241 7 лет назад

    Thank you it helped me a lot

  • @TheGauravmankar
    @TheGauravmankar 10 лет назад +2

    You are awesome

  • @MrLinusunil
    @MrLinusunil 7 лет назад

    Worked, thanks!

  • @BlaBlah000
    @BlaBlah000 8 лет назад

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

  • @sjarreldevis6406
    @sjarreldevis6406 8 лет назад

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

  • @lulu-xd3lg
    @lulu-xd3lg 7 лет назад

    nice and concise

  • @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');

  • @DoorsExciteMe
    @DoorsExciteMe 9 лет назад

    Fantastic, thanks!

  • @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.

  • @UrbanKhalifah
    @UrbanKhalifah 10 лет назад +1

    very informative, thank you =]

  • @hiaQadeer
    @hiaQadeer 7 лет назад

    Thank you, it was interesting.

  • @shivshankar654
    @shivshankar654 6 лет назад

    can we upload the file without temporary file

  • @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 :(

  • @aviC137
    @aviC137 7 лет назад

    Thank you!

  • @japjap6406
    @japjap6406 8 лет назад

    how it will save in the xampp

  • @ALIMUNTH
    @ALIMUNTH 10 лет назад

    SAME ALEX from 2 years a go :)

  • @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.

  • @andyjohn907
    @andyjohn907 4 года назад

    thanks it worked for me..

  • @jetongjonbalaj972
    @jetongjonbalaj972 6 лет назад

    Does this work on online servers?

  • @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

  • @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)

  • @hassankhalid2520
    @hassankhalid2520 8 лет назад

    Great Demonstration (Y)

  • @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.

  • @wazihsabir8740
    @wazihsabir8740 8 лет назад

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

  • @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.

  • @sanchitapaul2823
    @sanchitapaul2823 6 лет назад

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

  • @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.

  • @aramsadoyan5233
    @aramsadoyan5233 9 лет назад

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

  • @websiteprogrammer7307
    @websiteprogrammer7307 7 лет назад

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

  • @ǿǿřǿ-j6z
    @ǿǿřǿ-j6z 5 лет назад

    thanq

  • @Trambulhao
    @Trambulhao 10 лет назад +1

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

  • @wickedsnuk3812
    @wickedsnuk3812 6 лет назад +1

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

  • @ImpulseYou
    @ImpulseYou 7 лет назад

    thx !

  • @Jattonroax
    @Jattonroax 6 лет назад

    what the fuck is tmp_name

  • @giangphan9291
    @giangphan9291 9 лет назад

    thank you :v

  • @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.