Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tempname() not working on client server
- Warning: ftp_rawlist() [function.ftp-rawlist]: Unable to create temporary file. Check permissions in temporary files directory.
- 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 directoryn");
- };
- if(!($a = ftp_rawlist($conn_id, '-1t'))){
- Error::throwOne("Couldn't get ftp_rawlistn");
- };
- $server_file=($a[0]);
- if (!ftp_get($conn_id, LOCALFILE, $server_file, FTP_BINARY)) {
- Error::throwOne("Couldn't get filen");
- };
- ftp_close($conn_id);
- };
- $tmpdir = sys_get_temp_dir();
- echo "Temp dir: $tmpdirn";
- echo is_writable($tmpdir) ? "Temp dir is writable" : "Temp dir is not writable";
Add Comment
Please, Sign In to add comment