Jump to content

Recommended Posts

I know the basic functionality of PHP file upload and download. I need some idea about how to upload files to a specific date and download when that date is selected.

 

I need to upload daily reports to server. When user wants to see the report, he needs to select the date. So the reports uploaded that date will be listed and user can download the report. Can anyone help me how to do that using php ?

When you upload the files you would save a record in your database indicating the filename and the associated date (either user entered or automatic).  Then to list them just run a query against the table for any files in a given date range and generate your list with a link to the file.

 

The steps would look something like

if (/* User is uploading */){ 
    //Save the file somewhere to disk
    //Store location saved and date to database
}
else if (/* User is searching */){
   //Query database for files where date = $userEnteredDate (or date between $userDate1 and $userDate2 for a range)
   while (/* we have results from above query */){
        //Output a link to the file using the stored path
   }
}

 

Write some code and try to implement the steps.  If you get stuck somewhere post the code and what you're stuck on.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.