Skip to content

Sending large files to stream sotrage #39

@Mohamed5550

Description

@Mohamed5550

Hi

I checked BunnyAPI.php file and found at line 100 this code

if ($url_type === 'BASE') {//General CDN
            curl_setopt($curl, CURLOPT_URL, self::API_URL . $url);
            curl_setopt($curl, CURLOPT_HTTPHEADER, array("Accept: application/json", "AccessKey: $this->api_key", "Content-Type: application/json"));
        } elseif ($url_type === 'STORAGE') {//Storage zone
            curl_setopt($curl, CURLOPT_URL, self::STORAGE_API_URL . $url);
            curl_setopt($curl, CURLOPT_HTTPHEADER, array("AccessKey: $this->access_key"));
        } else {//Video stream
            curl_setopt($curl, CURLOPT_URL, self::VIDEO_STREAM_URL . $url);
            curl_setopt($curl, CURLOPT_HTTPHEADER, array("AccessKey: " . $this->stream_library_access_key, "Content-Type: application/*+json"));
            if ($method === "PUT") {
                curl_setopt($curl, CURLOPT_POSTFIELDS, file_get_contents($params['file']));
            }
        }

As I see it uses file_get_contents to send the file, which stores the file first in memory
This can't work with large files

May I ask why don't you make it like storage to use CURLOPT_INFILE?

And thanks for the great package!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions