2 questions

  •  07-23-2010, 5:30 AM

    2 questions

    First question:

    when i want to upload a file i get the message
    my source code is the following:
     
    demo2.php:
        <form method="post">
        <input type="text" name="test" id="test" />
        <?php
            $uploader=new PhpUploader();

            $uploader->MultipleFilesUpload=true;
            $uploader->InsertText="Select multiple files (Max 10M)";
            
            $uploader->MaxSizeKB=10240;
            $uploader->AllowedFileExtensions="*.jpg,*.png,*.gif,*.bmp";
            
            $uploader->UploadUrl="demo2_upload.php";
            
            $uploader->Render();
        ?>
        </form>
        <script type='text/javascript'>
        function CuteWebUI_AjaxUploader_OnTaskComplete(task)
        {
            var div=document.createElement("DIV");
            var link=document.createElement("A");
            link.setAttribute("href","savefiles/myprefix_"+task.FileName);
            link.innerHTML=task.test+"You have uploaded file : savefiles/myprefix_"+task.FileName;
            link.target="_blank";
            div.appendChild(link);
            document.body.appendChild(div);
        }
        </script>
    demo2_upload.php:
     
    $uploader=new PhpUploader();

    $mvcfile=$uploader->GetValidatingFile();

    if($mvcfile->FileName=="accord.bmp")
    {
        $uploader->WriteValidationError("My custom error : Invalid file name. ");
        exit(200);
    }

    //USER CODE:
    echo $_POST['test'];
    $targetfilepath= "/home/www/web2/html/cycle4/uploads/uploads/files/" . $mvcfile->FileName;
    if( is_file ($targetfilepath) )
        unlink($targetfilepath);
    $mvcfile->MoveTo( $targetfilepath );

    $uploader->WriteValidationOK();


     Second question:

    As you can see, I have in demo2.php an input field "test". How can i access the value of this field? I want to write it in sql-database . can i read the value of this field in demo2_upload.php with $_POST['test']?
View Complete Thread