download & upload script not to and from database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ahmedalobaidy
    New Member
    • Mar 2010
    • 6

    download & upload script not to and from database

    I have a page (html&php)from this page post this action to
    <form method=post action="loadfil e.php" ENCTYPE="multip art/form-data
    well the loadfile.php is a script for upload file to the mysql data base and this is the code for loadfile.php
    Code:
    <?php $fold=$_REQUEST['fname'];$title=$_REQUEST['title'];$uploadedfile=$_REQUEST['uploadingfile']; $host="localhost";$user="";$pass="";$dbid="upload";$link=mysql_connect($host,$user,$pass);mysql_select_db($dbid); $path="hi/". $_FILES['uploadingfile']['name'];echo $path; move_uploaded_file($_FILES['uploadingfile']['tmp_name'],$path); mysql_query("insert into loading(folder,title,fileload) values('$fold','$title','$path')"); mysql_close($link);  ?><?php
    
    $fold=$_REQUEST['fname'];
    $title=$_REQUEST['title'];
    $uploadedfile=$_REQUEST['uploadingfile'];
    
    $host="localhost";
    $user="";
    $pass="";
    $dbid="upload";
    $link=mysql_connect($host,$user,$pass);
    mysql_select_db($dbid);
    
    $path="hi/". $_FILES['uploadingfile']['name'];
    echo $path;
    		
    move_uploaded_file($_FILES['uploadingfile']['tmp_name'],$path);
    
    mysql_query("insert into loading(folder,title,fileload) values('$fold','$title','$path')");
    
    mysql_close($link);
    
    
    ?>
    i want to change this code and make it upload to folder like (my upload
    ) on the hard disk folder's (www)

    in the same thing i want to make download to my hard disk from new file named (mydownload) and this is folder existing where (appserv) already installed (www) folder

    i hope to accept my best regards and best wishes
    Last edited by Dormilich; Apr 6 '10, 08:19 PM. Reason: Please use [code] tags when posting code
  • code green
    Recognized Expert Top Contributor
    • Mar 2007
    • 1726

    #2
    want to change this code and make it upload to folder
    Is it not a simple case of changing $path
    Code:
    move_uploaded_file($_FILES['uploadingfile']['tmp_name'],$path);
    Not sure what you mean here
    in the same thing i want to make download to my hard disk from new file named (mydownload) and this is folder existing where (appserv) already installed (www) folder
    But it sounds like you will need FTP functions

    Comment

    • ahmedalobaidy
      New Member
      • Mar 2010
      • 6

      #3
      thank u code green to replay and i hope u to continue with me

      my question is : what the loadfile.php cotained and how i can to write the right
      script that make this operation,,,,

      my second question was : i have hyperlink for download and when click on the hyperlink download started not to data base but to any place on my computer and then showed to some description about the file like (size,type,name )

      Comment

      • code green
        Recognized Expert Top Contributor
        • Mar 2007
        • 1726

        #4
        what the loadfile.php cotained and how i can to write the right
        script that make this operation
        PHP has good file operation functions. file_get_conten ts() will read a file to a string which is the simplest way to output to a browser
        i have hyperlink for download and when click on the hyperlink download started not to data base but to any place on my computer
        To move a file you simply rename it with
        Code:
        rename (string $oldname,string $newname)

        Comment

        • ahmedalobaidy
          New Member
          • Mar 2010
          • 6

          #5
          thank you code green to reply again

          but please my question was :
          Code:
          <?php $fold=$_REQUEST['fname'];$title=$_REQUEST['title'];$uploadedfile=$_REQUEST['uploadingfile']; $host="localhost";$user="";$pass="";$dbid="upload";$link=mysql_connect($host,$user,$pass);mysql_select_db($dbid); $path="hi/". $_FILES['uploadingfile']['name'];echo $path; move_uploaded_file($_FILES['uploadingfile']['tmp_name'],$path); mysql_query("insert into loading(folder,title,fileload) values('$fold','$title','$path')"); mysql_close($link);  ?><?php 
            
          $fold=$_REQUEST['fname']; 
          $title=$_REQUEST['title']; 
          $uploadedfile=$_REQUEST['uploadingfile']; 
            
          $host="localhost"; 
          $user=""; 
          $pass=""; 
          $dbid="upload"; 
          $link=mysql_connect($host,$user,$pass); 
          mysql_select_db($dbid); 
            
          $path="hi/". $_FILES['uploadingfile']['name']; 
          echo $path; 
            
          move_uploaded_file($_FILES['uploadingfile']['tmp_name'],$path); 
            
          mysql_query("insert into loading(folder,title,fileload) values('$fold','$title','$path')"); 
            
          mysql_close($link); 
            
            
          ?>
          that scrip exist in the loadfile.php and that script let me upload the files from my page on (loacalhost) to mysql,,,,
          how i can change it and make it upload not to mysql but to other place like(new folder on desktop)
          Last edited by Atli; Apr 11 '10, 07:13 AM. Reason: Added [code] tags.

          Comment

          • code green
            Recognized Expert Top Contributor
            • Mar 2007
            • 1726

            #6
            how i can change it and make it upload not to mysql but to other place like(new folder on desktop
            Well I have already suggested FTP and rename().
            What do you mean be 'change it'.

            Comment

            • ahmedalobaidy
              New Member
              • Mar 2010
              • 6

              #7
              thank u it's it is clear right now

              Comment

              Working...