About file copy in modperl

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sasimca007
    New Member
    • Sep 2007
    • 129

    About file copy in modperl

    Hi friends,
    I have one small doubt that is, i have to copy one file from tmp folder to the desktop. This is a modperl program, when i write linux command in that modperl program it is recognising tmp folder but it is not recognising the desktop folder. When i run that program in the browser it is telling the error like permission denied. My code is below:

    Code:
    package practice::filecopy;
    sub handler
    {
    $r=`cp /tmp/31-Mar-2009.csv /home/sasi/Desktop/31-Mar-2009.csv` or die "cant copy the file $!" ;
    return OK;
    }1;
    I think the /home/sasi/Desktop/ path is looking for the current folder i.e) /usr/lib/perl/5.8.7/practice (or) /usr/local/apache/htdocs. That's why it is giving the error like that Permission Denied. What is the solution

    It is compulsory, please help me.

    I am using Linux(Ubuntu),M odperl.
  • gpraghuram
    Recognized Expert Top Contributor
    • Mar 2007
    • 1275

    #2
    R u able to go to the Desktop folder from command prompt?
    First check that .

    Raghu

    Comment

    • sasimca007
      New Member
      • Sep 2007
      • 129

      #3
      About filecopy in modperl

      Yes i can go to desktop folder through command prompt , but not through modperl program because we writing the modperl programs in /usr/lib/perl/5.8.7/practice folder. That's why the browser does not recognising the desktop folder through the url, it is checking under current folder.

      Comment

      • numberwhun
        Recognized Expert Moderator Specialist
        • May 2007
        • 3467

        #4
        The program is probably looking in the webroot for the folder path. My recommendation would be to make a softlink in the webroot to the Desktop directory you want the files to go to.

        You should be able to do that with the following command, assuming you execute this in your webroot (usually /var/www/html, but check your httpd.conf file):

        Code:
        ln -s /path/to/desktop/folder Desktop
        The word "Desktop" is what the link will be called where you create it. Replace "/path/to/desktop/folder" with the path to the Desktop folder you want to link to.

        Regards,

        Jeff

        Comment

        Working...