[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –
Beginner PHP Tutorial – 87 – Uploading Files: The Basics
by
Tags:
Comments
46 responses to “Beginner PHP Tutorial – 87 – Uploading Files: The Basics”
-
superrb boss. good work. i learned lot in a small time, thank you!!!!!!
-
this was very helpful thank you!!!
-
Hi,
"Notice: Undefined index: file "
I checked in php.ini and file_uploads is On !
Someone can help me?
Thanks!
-
is the large image file unable to upload? example 7mb..
-
how to you change the open php.ini file and set Fileupload :On on codeanywhere?
-
Bucky, what happened to your voice? Lol. JK.
-
thanks
-
Stolen Code.
-
intresting, I like it
-
good kbs
-
Anyone Please Help Me I want to know that what is this Error: Undefined index file 🙁
-
thanks so much helpfull =)
-
Your lesson is getting interesting 🙂
-
thx bro 😀 my project is fixed now :v thanks a lot :V
-
osm and simple tutorial
-
this will fix your problem :
echo @$name = $_FILES['file']['name']; -
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 -
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. -
cool!!!
-
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
-
You can use print_r($_FILES['file']);
If you wish to view all the keys/values of the associative array for the file. -
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! 😀
-
<?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>
-
undefined index line 2
-
Clearly explained. Nyce..
-
Great video! Thanks 🙂
-
Good video, very informative. But, the first two minutes is pretty much ramble. Tutorial "starts" at 1:44
-
(Y) good tutorial, but I got "Notice: Undefined index: file " on my upload.php
Do you know why it displays this error?
-
Thanks Brother . 🙂
-
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 !
-
just put this
error_reporting(0); in your php body -
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.
-
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! -
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
-
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. -
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. -
the sequencing on these is a mess.
-
if(isset($_FILES['files'])){
echo $_FILES['files']['name'];?>
This will help you get without undefined index
-
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!
-
did you figure out what the problem was?
-
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.
-
why did someone dislike????? great vids alex!
-
@hohoyun i know right …
-
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
-
Please Upload the tutorial to how to give a download link on our webpage from our database.
-
this upload series should come before tutorial 84
Leave a Reply