techcone Posted July 31, 2008 Share Posted July 31, 2008 Hello developers. Here is quick review on my problem. My users download files from rapidshare using my acc. Means rs->myserver->user Now while file is still being downloaded, i gave them the dl link so they don't have to wait. Using the dl link, when they start downloading , the file size is reported incorrect bcoz it is still in being state of downloading. Any possible remedy of tht ?? Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 31, 2008 Share Posted July 31, 2008 and the php question is? Quote Link to comment Share on other sites More sharing options...
discomatt Posted July 31, 2008 Share Posted July 31, 2008 I believe in the request, the size of the file should be contained somewhere in the headers. This isn't always the case though. Quote Link to comment Share on other sites More sharing options...
techcone Posted July 31, 2008 Author Share Posted July 31, 2008 question is i have used copy() function to download the file. How can I preallocate the size to the file. So tht when users try to download the file, they get correct file size ? Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 31, 2008 Share Posted July 31, 2008 you need to get data using http://us3.php.net/manual/en/function.filesize.php http://us3.php.net/manual/en/function.filetype.php etc. and then using the header() tell it what the size is and the dialog box will match. Quote Link to comment Share on other sites More sharing options...
discomatt Posted July 31, 2008 Share Posted July 31, 2008 get_headers() http://php.net/manual/en/function.get-headers.php will allow you to retrieve the headers which may contain the total file size. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 31, 2008 Share Posted July 31, 2008 you need to set the headers before you get them if it is being treated as a stream Quote Link to comment Share on other sites More sharing options...
techcone Posted July 31, 2008 Author Share Posted July 31, 2008 Means first I should get the file size from array of getheaders, create a stream of same filesize and give to user correct ? Quote Link to comment Share on other sites More sharing options...
discomatt Posted July 31, 2008 Share Posted July 31, 2008 you need to set the headers before you get them if it is being treated as a stream Huh? I'm not sure you know what he's trying to accomplish Means first I should get the file size from array of getheaders, create a stream of same filesize and give to user correct ? Should work fine. Personally, I'd grab them when I open the initial stream from RapidShare, then store somewhere ( database perhaps ) for easy, reliable access when you stream the file to the user. Quote Link to comment Share on other sites More sharing options...
techcone Posted July 31, 2008 Author Share Posted July 31, 2008 Yup just testing , I will reply soon. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.