promotingspace.net
Aug 21st 2007, 9:52 pm
Hi
I am still playing with an upload file script and having problem.
I upload and copy the files but cannot hash its name.
i use this code but the result is missing extention and so the file will not be opened
what is the solution?
thanks
<?php
$name= $_FILES["file"]["name"];
$ar=explode(".",$name);
$ext=$ar[1];
move_uploaded_file($_FILES["file"]["tmp_name"],
"uploads/" . $_FILES["file"]["name"]);
$newname=md5(time());
rename('uploads/'. $_FILES["file"]["name"],'uploads/'.$newname.$ext);
echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
?>
I am still playing with an upload file script and having problem.
I upload and copy the files but cannot hash its name.
i use this code but the result is missing extention and so the file will not be opened
what is the solution?
thanks
<?php
$name= $_FILES["file"]["name"];
$ar=explode(".",$name);
$ext=$ar[1];
move_uploaded_file($_FILES["file"]["tmp_name"],
"uploads/" . $_FILES["file"]["name"]);
$newname=md5(time());
rename('uploads/'. $_FILES["file"]["name"],'uploads/'.$newname.$ext);
echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
?>