SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Nov 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help needed regarding an docx upload script error

    Hi, I wrote a php script to upload docx, doc , pdf file to the server in abc folder and i want that file to be renamed with the name of uploader with uploading date as prefix. When i run it , it shows me errors in line 13 and 14.Please help me . thanks in advance

    PHP Code:
    <?php
    define
    ("UPLOAD_DIR""C:\wamp\www\abc\""); ///home/mgcons/my_file_uploads
    $name=$_POST["name"];
    if(!empty(
    $_FILES["uploaded_file"] )){
        
    $myFile=$_FILES["uploaded_file"];
        if (
    $myFile["error"] !== UPLOAD_ERR_OK){
            echo 
    "<p>An error occurred.</p>";
            exit;
            }
            
    $day=mktime(date("m"),date("d")+1,date("Y"));
            
    $ab=date("d m Y",$day);
            
    $bc=$ab.$name;
        
    $file_name=preg_replace($myFile["name"],$bc,$myFile["name"]);
        
    $success=move_uploaded_file($myFile["tmp_name"],UPLOAD_DIR.$file_name);
        if(!
    $success)
        {
            echo 
    "Unable to save file.";
            exit;
            }
            
    chmod(UPLOAD_DIR $file_name644);
        }
        
    $mime="application/pdf; charset=binary"."application/vnd.openxmlformats-officedocument.wordprocessingml.document"."application/vnd.ms-word.document.macroEnabled.12"."application/vnd.openxmlformats-officedocument.wordprocessingml.template"."application/vnd.ms-word.template.macroEnabled.12"."application/msword";
        
    exec("file -bi " $_FILES["$myFile"]["tmp_name"], $out);
        if(
    $out[0] != $mime){
            echo 
    "File is not supported";
            }
            
    exec("clamscan --stdout "$_FILES["$myFile"]["tmp_name"], $out$return);
            if (
    $return){
                echo 
    "This file is infected";
                }
    ?>

  2. #2
    SitePoint Member
    Join Date
    Oct 2012
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can you tell us, what line of code and the error you get?

  3. #3
    SitePoint Member
    Join Date
    Nov 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it gave me these errors11201641.jpg


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •