🔒 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
  • 570
    Views
  • 4
    Participants
Last reply from:
Jmrie_

Trending Topics

Online now

Members online
1,108
Guests online
3,625
Total visitors
4,733

Forum statistics

Threads
2,306,263
Posts
29,170,742
Members
1,194,750
Latest member
cardopo
Back
Top