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

  • SEARCH
  • Home
  • 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 8072277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:58:28+00:00 2026-06-05T13:58:28+00:00

I did a script, which has to load a file from a ftp-server then

  • 0

I did a script, which has to load a file from a ftp-server then parses it. The code relies on tempname to store the temporarily store the ftp-file. On my developement server (with php 5.3.10), this works flawlessly, however on the client machine (with php 5.2.17) it does not and gives me:

Warning: ftp_rawlist() [function.ftp-rawlist]: Unable to create temporary file. Check permissions in temporary files directory.

Can someone give me a clue what i could do?
(I am a little weak on the possibiities of php)

I used this code:

define ("LOCALFILE",tempnam('/tmp', 'data-'));
define ("USER","myusername");
define ("PASS","mypassword");
define('SERVER', "ftpserver.com");
define ("DIR","/path/");

function getFTPFile(){

    // connect
    if(!($conn_id = @ftp_connect(SERVER))){
        Error::throwOne("Could not connect to ".SERVER);

    };
    // login 
    if(!($login_result = @ftp_login($conn_id, USER, PASS))){
        Error::throwOne("LOGIN INCORRECT! user:".USER." pass:".PASS);
    };
    // try to change the directory to somedir
    if (!ftp_chdir($conn_id, DIR)) {
        Error::throwOne("Couldn't change directory\n");
    }; 

    if(!($a = ftp_rawlist($conn_id, '-1t'))){
        Error::throwOne("Couldn't get ftp_rawlist\n");
    };

    $server_file=($a[0]);
    if (!ftp_get($conn_id, LOCALFILE, $server_file, FTP_BINARY)) {
        Error::throwOne("Couldn't get file\n");
    };
    ftp_close($conn_id);    
};
  • 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-05T13:58:29+00:00Added an answer on June 5, 2026 at 1:58 pm

    I found the issue.
    Since my hoster does not like the /tmp directory ( who would blame them )
    i need to first set
    putenv(‘TMPDIR=/the tmp-dir my provider gave me’);
    which then works with tempname

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

Sidebar

Related Questions

I am developing a module which has a jQuery script with some AJAX code.
I've set up a simple, single-service server which has been working just fine with
I have done fastload for table which has more than one column (I did
I have a js script which has only one variable, but that variable holds
I am using fancy box iframe to display my page which has the file
I'm calling 2 JS functions(Ajax) each of which are returning data from the server.But
This question has two parts. Part 1. Yesterday I had some code which would
I have the following very simple code snippet which is loaded from a separate
i have a problem my script has three mysql_query which should be used after
Did you ever have the following situation: you need to store information, but a

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.