1 year ago

How to download a file from a blob url

Posted 1 year ago by karthik_dev

I'm getting a preview link or blob link from the frontend(reactjs).I tried many ways to download the file using "blob:http://localhost:3000/6abc903f-e38c-4ad0-9b68-87d05314f76f"

          $content = file_get_contents($modelfilepath); // URL of your blob object
         file_put_contents('/my/folder/flower.jpg', $content);`
Also tried with curl but not able to download and save the file in the server.

$str = $request->values['modelfile']; $modelfilepath= trim($str,"blob:"); $ch = curl_init($_GET[$str]); $fp = fopen('C:\xampp\test', 'wb'); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); fclose($fp);

Please help me to solve this issue.

Please sign in or create an account to participate in this conversation.