• harshap

    (@harshap)


    http://107.170.36.57/product-add
    this is file
    File upload is not possible .its showing error
    Forbidden

    You don’t have permission to access /wp-content/uploads/product/ on this server.
    even i changed file permission to 755 even thou file not moving…

    Thanks
    Prakash

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter harshap

    (@harshap)

    <?php
    if(isset($_POST[‘submit’]))
    {

    if(count($_FILES[‘upload’][‘name’]) > 0){
    //Loop through each file
    for($i=0; $i<count($_FILES[‘upload’][‘name’]); $i++) {
    //Get the temp file path
    $tmpFilePath = $_FILES[‘upload’][‘tmp_name’][$i];

    //Make sure we have a filepath
    if($tmpFilePath != “”){

    //save the filename
    $shortname = $_FILES[‘upload’][‘name’][$i];

    //save the url and the file
    // chmod(“http://107.170.36.57/wp-content/uploads/product/&#8221;,0755);
    $newfile = “http://107.170.36.57/wp-content/uploads/product/&#8221;;
    if($newfile==true )
    {

    $filePath = “http://107.170.36.57/wp-content/uploads/product/&#8221; .$_FILES[‘upload’][‘name’][$i];
    echo $filePath.”
    “;
    }
    else
    {
    echo “upload not possible”;
    }
    //Upload the file into the temp dir
    chmod(“http://107.170.36.57/wp-content/uploads/product/&#8221;,0755);
    if( move_uploaded_file($tmpFilePath, $filePath)== true)
    {
    echo “true there”;
    $files[] = $shortname;

    }
    else
    {
    echo “not possible”;
    }
    }

    }
    /* foreach($file1 as $f)
    { echo $f.”
    “; }
    array_push($attachments,$f);
    */
    }
    $var = count($files);

    for($i = 0;$i < $var; $i++)
    {
    $val = “http://107.170.36.57/wp-content/uploads/product/&#8221;.$files[$i];
    //echo $val.”
    “;
    $attachments[] = $val;
    }
    }
    foreach($attachments as $a)
    {
    $a.”
    “;

    }
    }
    this is code

    Clarion Technologies

    (@clarionwpdeveloper)

    Hello harshap,

    Have you changed the /uploads folder permissions recursively ?If not please try changing the permission recursively to all folder inside the uploads folder.

    Thanks

    Thread Starter harshap

    (@harshap)

    Hello Clarion Technologies thanks for reply
    I changed the permission to 0755 and even to 0777 but its still not working…

    Thanks
    Prakash

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘File upload’ is closed to new replies.