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

Trending Topics

Online now

Members online
1,102
Guests online
1,748
Total visitors
2,850

Forum statistics

Threads
2,286,546
Posts
29,038,569
Members
1,217,045
Latest member
usrbrave
Back
Top