🔒 Closed Php

Status
Not open for further replies.
check mo sa w3schools dun ako una nagaral nung sa download and upload ng php eh. pero mas madadalian ka kung naka framework ka like codeigniter or laravel
 
Watch some videos on youtube, hope makatulong

https://phc.onl/#forbidden#/68J-6ga0gjI

https://phc.onl/#forbidden#/NKzyljxhpjc

https://phc.onl/#forbidden#/Ze-k4eihJSQ

https://phc.onl/#forbidden#/9iFw-jsGyyY
 
<?php
include_once 'dbconfig.php';
if(isset($_POST['btn-upload']))
{

$file = rand(1000,100000)."-".$_FILES['file']['name'];
$file_loc = $_FILES['file']['tmp_name'];
$file_size = $_FILES['file']['size'];
$file_type = $_FILES['file']['type'];
$folder="uploads/";

// new file size in KB
$new_size = $file_size/1000000;
// new file size in KB

// make file name in lower case
$new_file_name = strtolower($file);
// make file name in lower case

$final_file=str_replace(' ','-',$new_file_name);

if(move_uploaded_file($file_loc,$folder.$final_file))
{
$sql="INSERT INTO tbl_uploads(file,type,size) VALUES('$final_file','$file_type','$new_size')";
mysql_query($sql);
?>
<script>
alert('successfully uploaded');
window.location.href='filemanager.php?success';
</script>
<?php
}
else
{
?>
<script>
alert('error while uploading file');
window.location.href='filemanager.php?fail';
</script>
<?php
}
}
?>
 
Status
Not open for further replies.

About this Thread

  • 16
    Replies
  • 577
    Views
  • 4
    Participants
Last reply from:
Jmrie_

Trending Topics

Online now

Members online
857
Guests online
2,719
Total visitors
3,576

Forum statistics

Threads
2,320,249
Posts
29,205,053
Members
1,179,655
Latest member
Senpaidick
Back
Top