Troll question of Php-write downlaod time in zip file

Discussion in 'PHP' started by ironmankho, Jun 2, 2012.

  1. #1
    Hi
    I think this is Troll question of Php-write downlaod time in zip file how it is possible

    like

    i uploaded this file

    myfile.zip

    when user 1 download this file @ 1:29

    it will

    myfile-1:29.zip

    second user download @ 12:45
    then it will

    myfile-12:45.zip

    so i hope you understand it ............. i need hint about this

    Thanks
     
    ironmankho, Jun 2, 2012 IP
  2. akhileshbc

    akhileshbc Active Member

    Messages:
    98
    Likes Received:
    1
    Best Answers:
    5
    Trophy Points:
    75
    #2
    Ok. here it goes.

    Keep track of the files in a separate table in the db.
    For example:
    
    tblFiles
    -------
    file_id  |  original_filename  |  dynamic_filename
    
    Code (markup):
    So, when you upload the file, create a new record in that table with the filename as "original_filename" as well as "dynamic_filename". And later on, when user downloads the same file, update this record by changing the "dynamic_filename".
    The sample update statement would be like this:
    UPDATE tblFiles SET dynamic_filename = CONCAT(original_filename, '-' , DATE_FORMAT(NOW(), '%H:%i')) WHERE file_id = '123'
    Code (markup):
    So, when you list the filename to the user, just echo the "dynamic_filename" field.

    Reference links of mysql functions used:

    Hope it helps :)
     
    akhileshbc, Jun 3, 2012 IP
  3. ironmankho

    ironmankho Active Member

    Messages:
    393
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #3
    Thanks for your reply i appreciate your help ..............but my site is simple not db
     
    ironmankho, Jun 3, 2012 IP
  4. ironmankho

    ironmankho Active Member

    Messages:
    393
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55