Jump to content

abhi_madhani

Members
  • Posts

    32
  • Joined

  • Last visited

    Never

Posts posted by abhi_madhani

  1. Hi,

     

    I am already saving the file name to a seperate table in a database. - Acheived this by listing the file name, and passing the name as a variable to mysql_query insert statement.

     

    Now I need is to a 'save the data in those excel files' into the 'database'. - Controlling this via Web Inteface.

     

    Regards,

  2. Hi friends

     

    I am developing a functionality in a website where a Admin can publish/save 'excel' files to a database, that are uploaded to a server by members. To achieve this I have devised the following steps.

     

    1. A webpage that let admin view all the files uploaded on the server in a particular directory (.files/) . - DONE

    2. A PHP code that can grab names of the files in a array.

    3. A PHP wepage that can automatically publish/save those file to a database, without human intervention.

    [This page being able to read the array, and store the results in a database].

     

    Its a bit complicated process, but does anyone knows how to acheive this as to what should steps should I take to acheive this. Please guide me through this. If you want any more clarification as to what I am trying to achieve, then in simple term 'Publishing a file to database, via web interface'.

     

    Regards,

    Abhishek

     

  3. Hi,

     

    Try making the changes that above user has mentioned.

     

    Otherwise try this below script that works for my project

     

    	
    
    <input type='file' name='filename' size='25'>
    <input type='hidden' name='action' value='fileupload'><br>
    <input type=submit value='Upload File'>";
    
    <?php
    
    //Catching the variable value for upload script and setting the maximum upload size of a file.
    $action = $_POST["action"];
    $max_size = "1048576"; // Max size in BYTES (1MB)
    
    if ($action == 'fileupload')
    {
    	if ($_FILES["filename"]["size"] > $max_size) die ("<b>File too big!  Try again...</b>");
    
    		$location="./files/";
    		copy($_FILES["filename"]["tmp_name"],$location.$_FILES["filename"]["name"]) or die("<b>Unknown error!</b>");
    		$xlsfilelocation=$location.$_FILES["filename"]["name"];								
    		echo "<b><br><br>File Uploaded.</b>";
    		// for debug -->  $filename --> ".$destination."/".$filename_name."</h2>";
    }
    ?>

     

    Regards,

    Abhishek

  4. Hi friends,

     

    I took this script from php.net that lists a name of file from a specified directory.

     

    	$path = "./files/";
    if ($handle = opendir($path)) 
    {
    # 
    while (false !== ($file = readdir($handle)))
    {
    	if ($file != "." && $file != "..")
    	{
    		$thelist .= '<a href="'.$file.'">'.$file.'</a>';
    	}
    }
    closedir($handle);
    }

     

    can someone please shed off some light as to how this line of code is processed, and what it means.

     

    while (false !== ($file = readdir($handle)))

     

    Regards,

    Abhishek

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.