Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Zipping File

Status
Not open for further replies.

namida

Programmer
May 29, 2003
101
AU
Say I have a user list, and every user has his/her own profile
then the user have a friend list..

so I want to give the user an option where she / he can download the friends' profile.

Hopefully in one shot, now they can do it but first they have to view each friend's profile and save it one by one.

I am thinking of making a directory for each user, with the friends file in it. Meaning from the friend profile php, I would have to write it out to a .html file and store it in the user directory.

Then I would like the user to download the whole directory.

I don't really need the .html files to be kept in the directory. I just need them to be temporary files. To zip it and then for the use to download it


Is there any other way besides first writing the .html and then zipping them and then downloading and then deleting the .html?


Regards,

Namida
 
well, u could also put all profiles in one single .html file, separated by <hr> or something. that would make it a lot easier.
u can always follow your method, although it would take some time to get it to work :p
were you just asking for advice how to do it or want help with the code ?

Cheers,
jamesp0tter
 
Hi thanks for the reply.

I'll ask my users which method they prefer. *hopefully they choose your suggestion, lol* but the file could get huge and messy.

I'm asking for ideas on how to approach this problem first, I haven't got around to coding it actually. If I encounter any problems with the coding I'll ask again. I believe I need the gzip functions.. but that's all I know.

Anyone else has any idea?

:)

Thanks again


Regards,

Namida
 
If your users don't like the clumsiness of one huge, hard-to-navigate file, you might want to code your PHP to generate one HTML file, using JavaScript to show/hide each piece of content. For example:
Code:
<html>
<head>
  <style>
    .panel {display: none}
  </style>
</head>
<body>
<table>
  <tr>
    <td>
      <a href=&quot;javascript:namida.display='inline'&quot;>namida's Profile</a><br>
      <a href=&quot;javascript:jamesp0tter.display='inline'&quot;>jamesp0tter's Profile</a><br>
      <a href=&quot;javascript:apatterno.display='inline'&quot;>apatterno's Profile</a><br>
    </td>
    <td>
      <div class=&quot;panel&quot; id=&quot;namida&quot;>
        Hello, my name is namida and I've been using Tek-Tips since May 29, 2003.
      </div>
      <div class=&quot;panel&quot; id=&quot;jamesp0tter&quot;>
        Hello, my name is jamesp0tter and I've been using Tek-Tips since Feb 20, 2003.
      </div>
      <div class=&quot;panel&quot; id=&quot;apatterno&quot;>
        Hello, my name is apatterno and I've been using Tek-Tips since Nov 26, 2003.
      </div>
    </td>
  </tr>
</table>
</body>
</html>

Notes:
1. You'll have to work on this.
2. You must be sure your users aren't using reeealy old browsers (i.e., they need at least IE 4 or Nescape 4. but everyone has one of those by now, right?)

But if you get it to work, it would look a lot cooler than a zip archive, and a lot more easy to use than a huge, cumbersome HTML file.

I REALLY hope that helps.
Will
 
thx for the idea. I'll keep it for reference. It's just that I need the files to be printable and be downloadable (not viewed in the browser)

Regards,

Namida
 
Argh! I Just realized that the gz functions compress strings.. what if I want to compress several files together including binary.

THe profile have photos in them. I have managed to write them into seperate .html files.

If I put all the profile in one file and then compress that one file I think it would kinda defeat the purpose of the compression. I want the user to be downloading a zip that will be extractable to multiple directories and multiple files.

Anyone has any idea?

Thanks



Regards,

Namida
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top