Jump to content

hobojjr

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

hobojjr's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I have a webservice that returns array of objects. The problem is that when there is only one element in the array then the SOAP message does not return an "array". So when I try to output the returned data in foreach I get an error. Casting only works if the returned "array" is a simple type (string, int, etc) but if it is an object array then casting will turn the fields of the object into elements of the array. Example: Service returns array of users - each user has two fields: name and email. When there is more than one user returned then foreach works fine: foreach($users as $user)... But when there is only one user then foreach will throw and error because $users is not an array and casting $users to array will turn user fields in to array elements. I hope you understand what I am saying.
  2. Hi, How can some function be undefined or not found in a php version which supports them? For example imagettfbbox (PHP 3 >= 3.0.1, PHP 4, PHP 5) is undfed undefined even though my php is  4.4.2.
  3. hi I found this code to upload multiple files [code] foreach ($_FILES["pictures"]["error"] as $key => $error) {   $name = $_FILES["pictures"]["name"][$key]; if ($error == UPLOAD_ERR_OK) {       $tmp_name = $_FILES["pictures"]["tmp_name"][$key];       move_uploaded_file($tmp_name, $uploadDir.$name); ....[/code] it works fine for 1-5 small files but when i try to upload 10 photos i get invalid agrument in foreach call... anyone know whats going on?
  4. Yes, everyone on a shared hosting has the problem. No one as of yet showed a solution that doesn't invole php ftp. http://ca.php.net/mkdir read the comment by "Han Van den Hoof"
  5. get this error "Call to a member function on a non-object" at this line $d=dir(getcwd()); while (false !== ($entry = $d->read())) { what gives?
  6. here did some reading  lol from comments at http://ca.php.net/mkdir " Han Van den Hoof 09-Nov-2003 01:28 If you're on a shared *nix server, a directory created through mkdir() will not be assigned to you, but to the user that your host's server or php process is running under, usually 'nobody', 'apache' or 'httpd'. In practice, this means that you can create directories, even add files to them, but you can't delete the directory or its contents nor change permissions. It is therefore advised to create directories through PHP's FTP API. Here's a function I wrote: <?php // create directory through FTP connection function FtpMkdir($path, $newDir) {         $server='ftp.yourserver.com'; // ftp server       $connection = ftp_connect($server); // connection         // login to ftp server       $user = "me";       $pass = "password";       $result = ftp_login($connection, $user, $pass);   // check if connection was made     if ((!$connection) || (!$result)) {       return false;       exit();       } else {         ftp_chdir($connection, $path); // go to destination dir       if(ftp_mkdir($connection,$newDir)) { // create directory           return $newDir;       } else {           return false;            }   ftp_close($conn_id); // close connection   } } ?> Hope this comes in handy for someone. "
  7. I need to do it with php script. When I run my script I end up with a dir that I cannot delete it or the files inside. edit---- the problem is, when I run the script and creat new dir and copy the files, I cannot delete the dir/files and I cannot change their mod from my ftp account. I am hosted by yurx.com ----general server info---- Operating system  Linux Service Status Click to View Kernel version 2.6.9-22.ELsmp Machine Type i686 Apache version 1.3.36 (Unix) PERL version 5.8.7 Path to PERL /usr/bin/perl Path to sendmail /usr/sbin/sendmail Installed Perl Modules Click to View PHP version 4.4.2 MySQL version 4.1.21-standard cPanel Build 10.8.2-RELEASE 119 Theme cPanel X v2.5.0 Documentation Click to View cPanel Pro 1.0 (RC36)
  8. Thanks for the welcome and your reply. I know how to write my script but I am not getting the result I want. I need to know what permission to set for the folder and the scripts while going through the above mentioned stages.  ;D
  9. Hi, I am trying to do the following 1)new dir 2)copy existing files to new dir 3)upload some new files to the new dir 3)do something to the new files 4)delete copied files At the end I want to end up with the new dir so that people can read it only. Can somone help me out with the file/folder mod permission for each step?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.