Jump to content

Please help me out.


dbnet

Recommended Posts

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();

}

Link to comment
https://forums.phpfreaks.com/topic/247235-please-help-me-out/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/247235-please-help-me-out/#findComment-1269744
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.