dbnet Posted September 15, 2011 Share Posted September 15, 2011 Please any kind hearted person should help me out, the code below is what i use to upload file...it worked locally but online it refused to move uploaded files into the destination folder. Please help me. function findexts ($filename) { $filename = strtolower($filename) ; $exts = split("[/\\.]", $filename) ; $n = count($exts)-1; $exts = $exts[$n]; return $exts; } $s=rand(1000000000,9999999999); $_SESSION['slot_id']=$s; if(isset($_POST['upload'])){ $uploaded=check_input(trim($_FILES['uploaded'])); if($_FILES['uploaded']['name']==""){ $msg="Upload Image Please"; header("Location:index.php?msg=$msg"); exit(); } $ext = findexts ($_FILES['uploaded']['name']) ;// exit; //$ran = rand () ; //echo $id;exit; $ran = $_SESSION['slot_id']; $ran2 =$ran."."; //<img src="passport/1267290864.jpg" /> $target = 'passport/image/'."/"; //if ($_FILES['uploaded']['type'] != "image/jpg"){ if ($ext != "jpg") { $msg="Invalide Image Type; Upload jgp only"; header("location:index.php?msg=$msg"); exit(); } $limit="100200"; if($_FILES['uploaded']['size']>$limit){ $msg="Image too big. Image must not exceed 100kb"; header("location:index.php?msg=$msg"); exit(); } $mm=$ran2.$ext; $targt = $target . $mm; // move_uploaded_file($_FILES['uploaded']['tmp_name'], $targt); $ct=$_FILES['uploaded']['tmp_name']; //$destination='passport/image/'."/".$_FILES['uploaded']['name']; exit; echo move_uploaded_file($ct,$targt)or die("Image Size is Too Big"); $_SESSION['mcm']=$mm; header("location:index.php"); exit(); } Quote Link to comment Share on other sites More sharing options...
requinix Posted September 16, 2011 Share Posted September 16, 2011 it worked locally but online it refused to move uploaded files into the destination folder. And you know it didn't work how? File not there? Error messages? Make sure the destination folder is world-writable. That means permissions 0777 aka rwxrwxrwx. Quote Link to comment Share on other sites More sharing options...
voip03 Posted September 16, 2011 Share Posted September 16, 2011 online it refused to move uploaded files into the destination folder. Please help me. Chack the online destination folder PATH! Quote Link to comment Share on other sites More sharing options...
dbnet Posted September 16, 2011 Author Share Posted September 16, 2011 Thank you for your posts i must say. if what u are saying is if i created the folder it should store the files, YES..if not then i dont know what online folder path is... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.