FTP Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationFTP Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 30th, 2002, 02:48 PM
fitznog fitznog is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 3 fitznog User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Error with ftp_put

This code was working 2 days ago. this script takes an image resizes and makes thumbnails, then ftps the files to a server!
It connects, starts the file upload, but dies. leaving one 0byte file. then i get this error

Warning: ftp_put: PORT command successful. in c:\apache\htdocs\gd\upload.php on line 45

Fatal error: Maximum execution time of 30 seconds exceeded in c:\apache\htdocs\gd\upload.php on line 46

////////////////////////////////////////////////////////////////////////////////////

PHP Code:
<?
$upload_amount
='4';
switch(
$action_id){
case 
3:
//          Connect to FTP Server!!!!!
        
$ftp_server "***********";
          
$conn_id ftp_connect("$ftp_server");
        
$VIN='test';
          
$login_result ftp_login($conn_id"*******""*******");
//        Error Checking the connection
          
if ((!$conn_id) || (!$login_result)) {
        echo 
"Ftp connection has failed!<br>";
        echo 
"Attempted to connect to ".$ftp_server." for user ".$user."<br>";
        die;
          } else {
//        Begin image resize code!
        
for($i=0;$i<$upload_amount;$i++){
              if (
is_uploaded_file($autoImage[$i])) {
                
$image_size[$i] = GetImageSize($autoImage[$i]);
//        Getting size ratio for larger images with a set width of 500 pixels
                
$new_w[$i] = '500';
                
$ratio_div1[$i] = $image_size[$i][0] / $new_w[$i];
                
$new_h[$i] = $image_size[$i][1] / $ratio_div1[$i];
//        Rendering Larger Images
                
$dst_img[$i] = ImageCreate($new_w[$i],$new_h[$i]);
                
$src_img[$i] = ImageCreateFromjpeg($autoImage[$i]);
                
ImageCopyResized($dst_img[$i],$src_img[$i],0,0,0,0,$new_w[$i],$new_h[$i],ImageSX($src_img[$i]),ImageSY($src_img[$i]));
                
$new_img[$i] = Imagejpeg($dst_img[$i],$autoImage_name[$i],80);
//      Getting size ratio for thumbnails with a set width of 100 pixels
                
$th_w[$i] = '100';
                
$ratio_div2[$i] = $image_size[$i][0] / $th_w[$i];
                
$th_h[$i] = $image_size[$i][1] / $ratio_div2[$i]; 
//        Rendering thumbnails
                
$dst_th_img[$i] = ImageCreate($th_w[$i],$th_h[$i]);
                
$src_th_img[$i] = ImageCreateFromjpeg($autoImage[$i]);
                
ImageCopyResized($dst_th_img[$i],$src_th_img[$i],0,0,0,0,$th_w[$i],$th_h[$i],ImageSX($src_th_img[$i]),ImageSY($src_th_img[$i]));
                
$th_name[$i] = "th_".$autoImage_name[$i];
                
$new_th_img[$i] = Imagejpeg($dst_th_img[$i],$th_name[$i],40);
//      Upload Now
                
if(!$new_img[$i]){echo"<center><b>Upload Failed!</b></center>";
                }else{
                
ftp_chdir($conn_id"htdocs/carlot");
                
ftp_mkdir($conn_id$VIN);
                   
ftp_chdir($conn_id$VIN);
//        FTP UPLOAD HAPPENS HERE
                
ftp_put($conn_id$autoImage_name[$i], $autoImage_name[$i], FTP_BINARY);
                
ftp_put($conn_id$th_name[$i], $th_name[$i], FTP_BINARY);
                
ImageDestroy($src_img[$i]);
                
ImageDestroy($new_th_img[$i]);                
                }
            }
            }
    }
break;
DEFAULT:
?>
    <form method='post' enctype='multipart/form-data' action='<?php echo $PHP_SELF."?action_id=3"?>'><input type='hidden' name='VIN' value='<? echo $VIN;?>'><?
    
for($i=0;$i<$upload_amount;$i++){
    
$m $i 1;
    echo
"<b>Photo ".$m."</b><br>
     <input type='file' name='autoImage[]'><br>"
;
    }
?>
    <input type='submit' name='upload' value='Upload Now'></form>
<?
break;
}
?>

Reply With Quote
  #2  
Old April 30th, 2002, 10:29 PM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
Eh... off hand I'd say it might have something to do with PASV mode. If it's set one way on the server and a different way on the client, connects work fine but any sort of transfer times out. Did the server config get changed recently?

Reply With Quote
  #3  
Old May 3rd, 2002, 11:43 AM
fitznog fitznog is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 3 fitznog User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Talking I GOT IT!!

I had to make sure I had the ftp modules installed for the ipchains or iptables. My computer connects to the net through a transparent proxy on another machine, the firewall worked for everything just fine except ftping with my script, which made this hard to find. Once i had the ftp modules installed right, my scripts started working again. Hope this helps those who had the same problem!!!




Quote:
Never give up, answers are ment to be found!

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationFTP Help > Error with ftp_put


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT