harishanchu / Laravel-FTP

A simple Laravel 4/5/6/7 ftp service provider with basic ftp methods.
220 stars 87 forks source link

Upload file in loop #20

Closed mrdaano closed 9 years ago

mrdaano commented 9 years ago

Hello,

I want to upload files with a loop. But I have create a loop:

$i = 1;
foreach(glob(storage_path().'/uploads/'.$opr.'-'.$ver.'-'.$spar.'*') as $picture) {
        echo $picture . "<br>";
    $info = pathinfo($picture);

    FTP::connection()->uploadFile($picture, 'public_html/project/'.$opr.'/images/'.$ver.$spar.'_'.$i.'.'.$info['extension']);
    $i++;
}

But it uploads only one file. And if I debug the file list I see every file.

foreach(glob(storage_path().'/uploads/'.$opr.'-'.$ver.'-'.$spar.'*') as $picture) {
        echo $picture . "<br>";
    $info = pathinfo($picture);
}

What can I do?

harishanchu commented 9 years ago

Looks like something is wrong with your remote file location.

You can debug the ftp upload by editing the laravel ftp source file in your project in the location: https://github.com/harishanchu/Laravel-FTP/blob/master/src/Anchu/Ftp/Ftp.php#L165