0

First of all, I did a lot of research already and none of the solutions apply to me. My problem seems to be a little more specific.

I have one html page on which I am generating a html content (to be more specific, it's a gallery that loads images from user's Dropbox account).

It would be a huge privacy issue to store the gallery on the server so I need to save the html code into a file on user's computer directly.

I tried two major solutions:

1) one php file - I don't think it's possible to do this, because the page will reload and the html code is then lost

2) separate html (login to Dropbox, generate gallery) and php (saving) files - it seems to be impossible to send the gallery code to the php file through ajax.

Any ideas, please?

This is a pretty open-ended question, my main goal is to come up with a privacy conscious solution so that the user can save it and doesn't have to wonder if I'm keeping his or her data.

One idea, for example: save the gallery as a file (I know how to do this part) and after the file is downloaded, delete it?

Stefan
  • 103
  • 2
  • 8
  • You should be able to generate the file and output it without actually saving it on your server. Coldfusion can do it, i'm pretty sure php can too. – Kevin B Mar 25 '13 at 15:00
  • @KevinB It seems that it is not possible in PHP in my specific case. And this is just a little project to learn/improve the knowledge of PHP/jQuery. I suppose Python could be an option too... – Stefan Mar 26 '13 at 13:11
  • Actually I seem to have another problem. I tried quite a few ways to force the HTML code to be download directly. It seems that there is another issue, perhaps something needs to be changed in the PHP configuration...or, to quote someone "maybe something regarding file creation on your system". I don't have enough time to really look for the solution, but this might work (editing the .htaccess file): http://stackoverflow.com/questions/1465573/forcing-to-download-a-file-using-php – Stefan Apr 02 '13 at 10:18

1 Answers1

1

I would save it to the server, and then use PHP to download the file. If you need to delete it after, do that.

$fp = fopen ("http://www.example.com/yourfile.html", "r");

while (!feof ($fp)) 
{
    $buffer = fgets($fp, 4096);
    echo $buffer;
}

fclose ($fp);
What have you tried
  • 11,018
  • 4
  • 31
  • 45
  • Thanks. This really seems to be the only option, I will just have to look into ways of deleting the file (whether it's possible to detect if it has been downloaded etc). I still don't like this solution, so I would like to wait and see if anyone can come up with anything. – Stefan Mar 25 '13 at 14:10