[PHP] Help!! ftp problems

2001-05-15 Thread galkin

Hi

I'm having trouble using php to ftp a file from a form.

I've scoured the lists and documentation but the answer elludes me.

I put in a MAX_FILE_SIZE variable, looked in the php.ini at the tmp_dir
(left blank to default to the system temp dir), chmod to 1777 of that
temp dir.  What am I not doing??

I get the error message: Warning: error opening [..'file'..]

Here's my code:



 global $filename, $MAX_FILE_SIZE;
 $backstr = bra
href=\javascript:history.back(-1)\Back/a;

  // An array with allowed file extensions
$allExt =
array(jpg,Jpg,JPG,gif,Gif,GIF);
$fileSize = filesize($filename);
   $ftp_server=ServerNameHere;
   $ftp_user_name=UserNameHere;
   $ftp_user_pass=PasswordHere;

if ($fileSize  $MAX_FILE_SIZE) {
  die(File size exceeds $MAX_FILE_SIZE
bytes.$backstr);
}


  /* This is to isolate filename from path.
Chosen separator
  / is for Mac and Unix-like operating
systems.
  */

$chunk_file = explode(/, $filename);
$numChunkFile = count($chunk_file);
$dstFile = $chunk_file[$numChunkFile - 1];

  // Now let's get file extension
$ext = explode(.,$dstFile);
$numChunkExt = count($ext);

  if (in_array($ext[$numChunkExt -
1],$allExt)) {
  $ftp_id = ftp_connect($ftp_server);
  $ftp_login =
ftp_login($ftp_id,$ftp_user_name,$ftp_user_pass);
  if (! $ftp_login) {
ftp_quit($ftp_id);
die(Connection failed, check your login
and password.$backstr);
  }

$ftp_put_file =
ftp_put($ftp_id,$dstFile,$filename,FTP_BINARY);
if (! $ftp_put_file) {
  echo Upload failed.$backstr;
}
else {
  echo Upload $dstFile was
successful.\n;
}

}
else {
  echo ERROR - Allowed file extensions
are:br\n;
  for ($i = 0; $i  count($allExt); $i++) {
echo b$allExt[$i]/bbr\n;
  }
  echo $backstr;
}
ftp_quit($ftp_id);
  }

Any help would be greatly appreciated!

Thanks,

Grant


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] ClibPDF -- problems with cpdf_rect and cpdf_lineto

2001-04-19 Thread galkin

Hi,

I've been playing around with ClibPDF and am pulling my hair out trying
to figure out some functions, specifically, cpdf_rect. and cpdf_lineto.
They seem straight forward enough, but I just can't get them to work.

Here's what I've tried so far:

cpdf_setrgbcolor_fill($pdf, 253, 15, 15);
cpdf_rect($pdf,10,300,400,400, 0);
cpdf_closepath($pdf);
cpdf_fill($pdf);
cpdf_stroke($pdf);

and

cpdf_moveto($pdf, 50, 50);
cpdf_lineto($pdf, 200, 350);
cpdf_closepath($pdf);
cpdf_fill($pdf);
cpdf_stroke($pdf);

Any thoughts?  What am I doing wrong???

Thanks,

Grant


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]