Unable to upload the file from local machine to server using php function
Question by Meena
i am uploading the file in the servier i am using the below code
move_uploaded_file($_FILES["uploadfile".$k]["tmp_name"],
"photoalbum/".$_SESSION["almgid"]."/".$_FILES["uploadfile".$k]["name"]);
$uploadfile = "photoalbum/".$_SESSION["almgid"]."/".$_FILES["uploadfile".$k]["name"];
This code is working fine in the local but the images are not uploading in the server how to solve this issue please help me,
this is the error message i am receive during uploading the file in server
Warning: move_uploaded_file(photoalbum/1cutebaby05.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/whspider/public_html/alumnimgmts/editprofile.php
i am already added the enctype=”multipart/form-data” in the form, i already check the image size,
Answer by Starx
IF they are working in local server, then it is the problem related to to authorities.
try
chmod("photoalbum/".$_SESSION["almgid"]."/",0755); // OR 0777 during testing only
before move_uploaded_file