Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7930417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:25:01+00:00 2026-06-03T20:25:01+00:00

I have a working drupal batch process. In it I want to copy image

  • 0

I have a working drupal batch process. In it I want to copy image files (JPGs) from a source directory into a target directory with PHP copy function. Both the directories exist. The source file does exist, too. But the copy does not succeed.

I checked for the file permissions of the source directory (0755) and the source file (0744) and the target directory (0755). The owner and group are that of the script.

I debugged by putting the success of the copy into watchdog. It says it was successfull. But the file is not there.

This is the code where the copy takes place

$copy_from = $_SERVER["DOCUMENT_ROOT"]."/".$file->filepath;
$copy_to = $_SERVER["DOCUMENT_ROOT"]."/".$path_new;


$success = false;
if (file_exists($copy_from)) {
    $success = copy($copy_from, $copy_to);
    watchdog('catalog_copy2', ($success ? 'yes' : 'no') 
      . ' | ' . "copy('{$copy_from}', '{$copy_to}')");
}

If I copy the watchdog output and edit it slightly to end up in an shell copy order

cp path/to/file dest_path

The file is copied with no fuzz at all. So no typos and no case sensitive issues are in order.

I’m clearly nearly out of my mind, because I do not understand why I cannot copy the files with PHP.

Strange thing though is, some of the files are copied with my batch and some are not.

I’d be grateful for any hint where to look for to find a solution.


edit

I’ve worked around the problem by using the shell cp command using php’s exec command. I’m not happy with this, but I had to make it work.


edit

I circumvented the problem by using the API function from the file_field module

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T20:25:03+00:00Added an answer on June 3, 2026 at 8:25 pm

    the problem was not solved, but I managed to use the API functions from the file_field modules which works perfectly

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on Drupal 6 and I have migrated it from a remote
I am working on a Drupal setup and have run into a slight issue
I'm working with Jquery in Drupal. I have sets of four blocks that all
I'm working in Drupal 6. I have a requirement to add a particular block
I am working on a Drupal 6 site that some CSS issues. I have
I am working on developing a drupal site right now. I have created a
I have a page that works fine pulling users and locations from a Drupal
I have a form that uploads a file to my Drupal installation. I want
In my home directory I have a folder drupal-6.14 that contains the Drupal platform.
I haven't seen working solution for Drupal 7 to do this. I have an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.