-1

hi!i need your help.Here are my question. i need to create a folder for that particular user and store the .pdf file inside, means different user for different folders.and inside the folder.i really need full coding.please help me!! :'(

Edited by Qyla21: nothing

3
Contributors
4
Replies
6
Views
4 Years
Discussion Span
Last Post by nuraqilah.ahmadkhairi.7
0

You're not going to get working code. If you show what you have, we can push you in the right direction.

0

oh,thanks..sorry..so,here is my coding:

in php:

<?php
/* 
        VIEW.PHP
        Displays all data from 'upload' table
*/

session_start();
if ($_SESSION['password'])

echo "<div style='font-family: Times New Roman; font-size: 18px; border: 1px solid #43A5EC; background: #F0F0F0; padding: 10px;'>"."Selamat Datang ke Sistem PBPaySlip Ruangan Admin"."<b>!</b>";


else

die("<div style='font-family: Verdana; font-size: 12px;>"."You must be logged in!"."</div>");

echo " | "."<a href='http://localhost/PBpayslip/view-paginated.php'>View Payroll here</a> | "."<a href='http://localhost/PBpayslip/uploadpenyatagaji.php'>Upload Staff's Payroll Here</a> | <a href='logout.php'>Logout<a/>"."</div>";
?>

<?php
if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0)
{
$fileName = $_FILES['userfile']['name'];
$tmpName  = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];

$fp      = fopen($tmpName, 'r');
$content = fread($fp, filesize($tmpName));
$content = addslashes($content);
fclose($fp);

if(!get_magic_quotes_gpc())
{
    $fileName = addslashes($fileName);
}
include 'library/config.php';
include 'library/opendb.php';

$query = "INSERT INTO upload (name, size, type, content ) ".
"VALUES ('$fileName', '$fileSize', '$fileType', '$content')";

mysql_query($query) or die('Error, query failed'); 
include 'library/closedb.php';

echo "<br>File $fileName uploaded<br>";
} 
?>

and code in html:

<!doctype html>
<html>
    <head>
        <title>Upload PBpayslip</title>
        <link rel="icon" href="http://http://localhost/PBpayslip/index1.php/img/icon32.png" sizes="32x32">

        <style>
            body {
                text-align:center;
                background-color:#DEF3FE;
                background-image:url(http://assets.sapphion.com/img/bg.gif);
                font-family:Arial, Helvetica, sans-serif;
                font-size:80%;
                color:#666;
                margin: 0;
                padding:0;
            }
            .File_Upload_Form {
                width:600px;
                margin:30px auto;
                background-color:#FFF;
                border-radius:4px;
                padding: 4px 20px 20px 20px;
            }
            h1 {
                font-family:Georgia, "Times New Roman", Times, serif;
                font-size:170%;
                color:#645348;
                text-decoration:none;
                font-weight:100;
            }   
            input[type="submit"]{
                border:1px solid #917568;
                border-radius: 4px;
                margin:0;
                padding:4px 10px 4px 10px;
                font-family:Georgia, "Times New Roman", Times, serif;
                font-size:14px;
                color:#333333;
                text-shadow:1px 1px 0 #fff;
                background-color:#A5B276;
                background-image: -webkit-linear-gradient(#CED8AF, #A5B276);
                background-image:-moz-linear-gradient(center bottom , #A5B276 0%, #727E47 100%); 
                background-size:1px 50px;  
                padding: 5px;
                cursor:pointer;
                -webkit-transition: background .5s ease-out; 
            }
            input[type="submit"]:Hover,:focus{  
                background-position:100px;  
            }  
        </style>
    </head>

    <body>
    <p>&nbsp;</p>
<p>&nbsp;</p>
        <div class="File_Upload_Form">
        <h1>Please Upload Staff's Payroll Here!</h1>

        <form enctype="multipart/form-data" id="upForm" action="Testing2" method="post">
          <input type="hidden" name="MAX_FILE_SIZE" value="2000000">
          <input type="file" name="file_input[]" id="file_input" multiple webkitdirectory="" directory="" mozdirectory>
            <input type="submit" value="Hantar" />
        </form>
        </div> 
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <table width="359" border="0" align="center" bgcolor="#FFFFFF">
  <tr>
    <th width="242" height="12" scope="row"><pre>ARAHAN : Please drag the folder that have you choose into button "Choose File". Thank You! :)</pre></th>
  </tr>
</table>
    </body>
</html>

my probleme is user can only view the folder in server and can't save it into database.so,any suggestion? :(

0

Thanks for reply :) Im Qyla21 and this is my 2nd account in daniweb.com ;) hm,no...the upload is working actually..but the problem rite now is i can't save the folder(with .pdf file inside) that i upload in database and only can view in server only.How i can change the coding...any suggestion? :(

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.