about 9 years ago
As we know that CURL is a library that allow us to make requests(HTTP requests) in PHP.
We can upload a file as well using CURL. For upload a file using CURL must follow below points :
Uploading file size is mandatory to be less than file allowed by the Server.
If file size is too big , then it may take a bit more time.
replace "http://localhost/test/index2" with that URL for which server has given the functionality for upload file.
$file_name_with_full_path = realpath('uploadFile.zip'); $url = "http://localhost/test/index2"; $post_data = array( "foo" => "bar", "upload" => "@".$file_name_with_full_path ); try { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); $output = curl_exec($ch); curl_close($ch); } catch (Exception $e) { echo $e->getMessage(); die; }
} catch (Exception $e) { echo $e->getMessage(); die; }
Starting with Chrome version 45, NPAPI is no longer supported for Google Chrome. For more information, see Chrome and NPAPI (blog.chromium.org).
Firefox and Microsoft Internet Explorer are recommended browsers for websites using java applets.
Chrome Version Support
Are you sure, you want to delete this comment?
Sign up using
0 Comment(s)