I need to upload files to a remote server from my local computer using a PHP script. So far everything is working nicely. The only problem is, how do I get a progress of the bytes sent so far. For example the percentage of the upload. Because sometimes I will have to upload large files, So its necessary for me to get the progress of the uploads. This is what I have so far, and It works properly. I only need to know how to get the progress of my uploads - $wwwhandle = curl_init(); curl_setopt($wwwhandle, CURLOPT_URL, $url); curl_setopt($wwwhandle, CURLOPT_HEADER, 0); curl_setopt($wwwhandle, CURLOPT_RETURNTRANSFER,1); curl_setopt($wwwhandle, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"); curl_setopt($wwwhandle, CURLOPT_COOKIEJAR, $file); curl_setopt($wwwhandle, CURLOPT_COOKIEFILE, $file); if ($action == "POST") { curl_setopt($wwwhandle, CURLOPT_POST, 1); curl_setopt($wwwhandle, CURLOPT_POSTFIELDS, $parameter); } if ($action == "GET" && $parameter != "") $url .= "?" . $parameter; $result=curl_exec($wwwhandle); curl_close($wwwhandle); return $result; PHP: Thanks.
You need to use Ajax or Flash technique if you want to display progress bar. Client side javascript/flash and server side you can use your php CURL code. Few examples: http://www.ajaxf1.com/tutorial/ajax-file-upload-tutorial.html http://www.swfupload.org/documentation/demonstration http://www.seemysites.net/projFolder/uploader/ Search google for more.
FredL Thanks a lot for the reply. But the problem here is that when I execute the line - curl_exec($wwwhandle); It will not give me any status of the upload. So its not possible for me to create a progress bar. I need a method to get the status from CURL. There is a function called CURLOPT_READFUNCTION to get the status, but still its not supported by PHP/CURL. It works fine when I use the command line CURL.Hope someone can help me out here. Thanks.
Hi, Have you received the script for this? if not, i have it with me. Please let me know in case you are yet to complete this task.