Hello everyone,
im totally new to PHP coding and this forum and I was wondering if there was anyone out there willing to help me get started uploading images using the $_FILES superglobal.. I ran the following script because I want to give users the ability to upload files(images/photos);
<?php
//this will check if form was submitted
if($_SERVER['REQUEST_METHOD']=='POST') {
//this checks if the file was uploaded without errors
if(isset($_FILES['photo'])
&& is_uploaded_file($_FILES['photo']['temp_name'])
&& $_FILES['photo']['error']==UPLOAD_ERR_OK){
//this will output the contents of files
foreach($_FILES['photo'] as $key => $value) {
echo "$key : $value <br/>";
}
} else {
echo"No File Uploaded!";
}
} else {
?>
<form action="test.php" method= "post"
enctype= "multipart/form-data">
<label for= "photo"> User Photo: </label>
<input type= "file" name="photo"/>
<input type= "submit" value= "Upload a Image here!" />
</form>
<?php } ?>
when I run this script, i am able to browse and selected images to upload.. but when i upload the image the browser does not output the "$keys : $value <br/>", instead the output echo's "no file uploaded!"...
is this because the files that im attempting to upload are too large, or is my script incorrect..?
I apologize if this has been previously addressed.. Im new to all this and I was not able to find anything that was of use to me..Im not looking for an image, just the notification that an image was received and uploaded!!
PLEASE HELP, Thanks!!!

