PHP Get File Size of Selected MySQL Data?

Adam Johnson

New member
Hi,

I'm exporting a lot of data from a MySQL database to a CSV files on a website.

To do this I have a form to select what to export which submits to a new page where I change the headers and echo the content which creates the download window.

I was wondering if it is possible to tell the file size a CSV file is going to be on the first page? So I can say, export: Item A (500kb) Item B (1024kb) etc.

What would be the best way of going about it? Would it be possible to get the size with a MySQL query as opposed to selecting all the data first to reduce database load?

Many Thanks,
Adam
 
Back
Top