09-16-2016, 07:22 AM
Ok, I got the file to upload, but now I cant get it to post into into the db (I managed to before but forgot how)
Hopefully you guys can help me.
// new file size in KB
// new file size in KB
// make file name in lower case
// make file name in lower case
` $sql="INSERT INTO users(file,type,size) VALUES('$final_file','$file_type','$new_size')";
mysql_query($sql);`
Hopefully you guys can help me.
Code:
if(isset($_POST['btn-upload']))
Code:
{
Code:
$file = rand(1000,100000)."-".$_FILES['file']['name'];
Code:
$file_loc = $_FILES['file']['tmp_name'];
Code:
$file_size = $_FILES['file']['size'];
Code:
$file_type = $_FILES['file']['type'];
Code:
$folder="cvs/";
// new file size in KB
Code:
$new_size = $file_size/1024;
// make file name in lower case
Code:
$new_file_name = strtolower($file);
Code:
$final_file=str_replace(' ','-',$new_file_name);
Code:
if(move_uploaded_file($file_loc,$folder.$final_file))
Code:
{
mysql_query($sql);`
Code:
?>