2 questions

Last post 07-25-2010, 6:50 AM by claude68. 2 replies.
Sort Posts: Previous Next
  •  07-23-2010, 5:30 AM 62674

    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']?
  •  07-23-2010, 10:05 AM 62677 in reply to 62674

    Re: 2 questions

    Issue 1:
    You do not have write permission of folder "uploadertemp", you can set the temporary directory to other folder and grant everyone full permission, you can try the following code:
    $uploader->TempDirectory="/uploaderdir";
     
    Issue 2:
     
    Keep us known.
     
    Regards,
    Eric
  •  07-25-2010, 6:50 AM 62696 in reply to 62677

    Re: 2 questions

    thanks
    it works now
    Claude
View as RSS news feed in XML