Page 1 of 1
Download File
Posted: Sun Jun 25, 2006 12:32 pm
by Clukey
Is it possible to have a user download a file onto their computer, then when when the download has completed update a database? I know how to update the database, but how can I do the rest? Thanks
Consider using
Posted: Sun Jun 25, 2006 2:03 pm
by akimm
Javascript or Html to mitigate the download. I'm sure php has a way but I'm way too new to demonstrate that for you.
Posted: Sun Jun 25, 2006 2:05 pm
by Clukey
How could I do that with html and then call a php function to update the record?
Posted: Sun Jun 25, 2006 2:09 pm
by Christopher
Look at PHP's header() function for information about downloads. You would update the database in the script as you normally would. However, once you generate the download response for the client/user, you cannot know what they did with the file.
Posted: Sun Jun 25, 2006 2:16 pm
by Clukey
I tried using header() but I am getting this Error
Code: Select all
Warning: Cannot modify header information - headers already sent by (output started at /home/folder1/folder2/page.php:35) in /home/folder1/folder2/page.php on line 40
Are there any workarounds? Thanks
Posted: Sun Jun 25, 2006 2:21 pm
by feyd
Posted: Sun Jun 25, 2006 2:31 pm
by Clukey
Thanks for that, I didn't need that echo anyway, but now it's giving me an error that says I am unauthorized to view that page. I do have hotlink protection enabled, but I have accesses set up for my domain and it's not giving me errors on any of the other file types, just this one. And this is the only one I access with php. Any suggestions?
Posted: Sun Jun 25, 2006 2:46 pm
by Christopher
I'm really not clear what you are talking about. What echo? What do "hotlink protection enabled" or "have accesses set up for my domain" mean? And when you say "other file types" do you mean differnt files or differnt MIME types set in the header?
Posted: Sun Jun 25, 2006 3:05 pm
by Clukey
I had an echo "blablabla"; at the top of my page which screwed up the header(). Hotlink protection disalowes people from accesing files on my server. When I say other file types I mean the hotlink protection is only set up for certain file extensions (jpg,bmp,mxp,ect...) and they all seemed to be working, but none of the other types are called by php.
I did find a fix for this however. I found this post on php.net:
http://us3.php.net/manual/en/function.header.php#65667
Thanks for all your help.