> > > Check your php.ini file to see if "file_uploads = on" - it is often
> turned
> > > off for security.
> >
> > Yep it is turned on.
> >
> > And php.ini is in /usr/local/php/lib/php.ini
> >
> > Any other ideas ?
> >
> > Jason
> >
> 
> need to see some code...

Here is the total chunk of code to date.

It does currently work, except for the file submission complaining about
the no file uploaded.

the current fragment of code to do with file submission is simply my
efforts to get the script to say that a file is being successfulyl
uploaded.

Jason


<?php

        //      submit_assign.php contains the 
        //      dynamically genertaed pages for
        //      the assignments.
        

        
        include_once("function.php");
        include_once("config.php");
        
        // Check validity of the user
        session_start();
        check_session(session_id(),$username);
        $priv = check_privledges($username,$subject);
        
        if($priv == "U")
        {
                login_bounce();
        }
        
        
        $student_dir = $current_assignment_directory . $subject . "/" . $assign ."/"  
. $username;

        // Perform any requested actions by the user either delete, retreive or view 
individual file

        if(isset($action))
        {
                // how to warn a user about deleting a file ?   
                // simply dont at the moment and delete file
                
                if($action == "delete")
                {
                        $stud_file_start = $student_dir . "/" .$filename;
                        $stud_file_end = $student_dir . "/" . old  . "/" . $filename; 
                        @rename($stud_file_start,$stud_file_end);
                }
                elseif($action == "retreive")
                {

                        // Send the file to the user
                        $stud_file = $student_dir . "/" . $filename;
                        header("Content-disposition: filename=$filename");
                        header("Content-type: application/force-download");
                        readfile("$stud_file");
                        die();
                }
                elseif($action == "view")
                {
                        // Now need to output the file using the 
                        // file hi-lighter
                        
                        
                }
                else
                {
                        $message = "$username tried to do $action on " . time();
                        log_msg($message);
                }
        
        }

        
        if(is_uploaded_file($userfile))
        {
                move_uploaded_file($userfile,"/tmp");
        }
        else
        {
                echo "No file Uploaded";
        
        }
        
        // Firstly to process any user instructions on the page
        
        $message = $subject . " " . $assign . " Submission";

        start_page($message);

        // Then dispaly the current directory state.

        print "<H3>Currently Submitted Files</H3>\n";
        
        $submit_dir = $current_assignment_directory . $subject . "/" . $assign ."/"  . 
$username;
        
        $param = 
"submit_assign.php?username=$username&subject=$subject&assign=$assign";
                
        if(file_exists($submit_dir) == false)
        {
                print "No Currently Submitted Files<P>\n";
        }
        else
        {
                $pwd = fetch_current_files($submit_dir);

                // Now to draw the table from the array.
        
                sort($pwd);     
        
                print "<TABLE>\n";
        
                while(($file = array_pop($pwd))!=NULL)
                {
                        // Print each line of the available file table
                        print "<TR><TD>$file</TD>\n";
                        print "<TD><A 
HREF=\"$param&upload=false&filename=$file&action=delete\">Delete</A></TD>\n";
                        print "<TD><A 
HREF=\"$param&upload=false&filename=$file&action=retreive\">Retreive</A></TD>\n";
                        print "<TD><A 
HREF=\"$param&upload=false&filename=$file&action=view\">View</A></TD></TR>\n";

                }
        
                print "</TABLE>\n";
        }
        
        // now to provide an assignment submission box
        print "<P>";
        print "<FORM ENC_TYPE=\"multipart/form-data\" ACTION=\"$param&upload=true\" 
METHOD=\"post\" >\n";
        print "<INPUT TYPE=\"hidden\" NAME=\"MAX_FILE_SIZE\" VALUE=\"1048576\">\n";
        print "<H4>Submit A File</H4><P> ";
        print "<INPUT TYPE=\"file\" NAME=\"userfile\" >\n<P>";
        print "<INPUT TYPE=\"submit\" VALUE=\"Upload\">\n";
        print "</FORM>"; 
        
        
        end_page();

?>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to