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 ?? Link to comment https://forums.phpfreaks.com/topic/117586-not-getting-correct-file-size/ Share on other sites More sharing options...
cooldude832 Posted July 31, 2008 Share Posted July 31, 2008 and the php question is? Link to comment https://forums.phpfreaks.com/topic/117586-not-getting-correct-file-size/#findComment-604815 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. Link to comment https://forums.phpfreaks.com/topic/117586-not-getting-correct-file-size/#findComment-604816 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 ? Link to comment https://forums.phpfreaks.com/topic/117586-not-getting-correct-file-size/#findComment-604823 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. Link to comment https://forums.phpfreaks.com/topic/117586-not-getting-correct-file-size/#findComment-604835 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. Link to comment https://forums.phpfreaks.com/topic/117586-not-getting-correct-file-size/#findComment-604846 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 Link to comment https://forums.phpfreaks.com/topic/117586-not-getting-correct-file-size/#findComment-604847 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 ? Link to comment https://forums.phpfreaks.com/topic/117586-not-getting-correct-file-size/#findComment-604866 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. Link to comment https://forums.phpfreaks.com/topic/117586-not-getting-correct-file-size/#findComment-604871 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. Link to comment https://forums.phpfreaks.com/topic/117586-not-getting-correct-file-size/#findComment-604874 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.