So I had this working, but when I went to add a little criteria to the code it started lagging. In other words when you run the script for it to use the ftp it wood take upwards of 40 minutes to complete the transfer, but the webpage never finishes. I am certain it is probably something simple but need a little help finding it.
Here is the code:
FPN is the URL to the image.
for($i=0; $i<$rstSEL->num_rows; $i++){
$rowSEL=$rstSEL->fetch_row();
$NewImgID[$i]=$rowSEL[1];
$qryIMG='SELECT ImageID, FPN FROM tblImages WHERE ImageID='.$rowSEL[1];
$rstIMG=$conDIMG->query($qryIMG);
$rowIMG=$rstIMG->fetch_assoc();
$FPN=fdbp_url($rowIMG['FPN']);
$ImgFil=explode('/',stripslashes($rowIMG['FPN']));
$rstIMG->free();
$ImgFil=$ImgFil[(sizeof($ImgFil)-1)];
if(strpos($FPN,'NAME')>0){
$NewFPN[$i]=mysql_escape_string('http://www.NAME.com/auci/'.$ImgFil);
}
if(strpos($FPN,'incoming')>0){
$NewFPN[$i]=mysql_escape_string('http://www.NAME.com/auci/'.$ImgFil);
$fp = fopen('../auci/incoming/'.$ImgFil, 'r');
$conn_id = ftp_connect($ftp_server);
//if($conn_id){
//echo "Conn is Good!";
//}
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
//if($login_result){
//echo "Login is good!";
//}
ftp_pasv($conn_id, true);
if (ftp_fput($conn_id, $ImgFil, $fp, FTP_ASCII)) {
$UploadMessage="Successfully Uploaded Images!!!";
$current_dir='../auci/incoming/';
unlink($current_dir.$ImgFil);
}
else{
$UploadMessage="There was a problem while uploading images.";
}
fclose($fp);
ftp_close($conn_id);
}
else{
$NewFPN[$i]=mysql_escape_string('http://www.DIFFERENTNAME.com/auci/'.$ImgFil);
}
}
Any help is appreciated.
FNP