Nicky
Nicky

Reputation: 1

downloading file from web page using php

My situation is when user enter the keyword associated with the video file and press enter.Out put is alll the details regarding video file which has match with the key word from MySQL DB.Now here I have stored video file in the server location and stored path of the video file in Mysql database. When user click on the name of the video file in output shown , he should be able to download the particular video file from server location to his local disc drive. There would be several video files name in the output having matched keyword.

I have written the code in PHP...only thing left is downloading video file on clicking in video name. Though I refered several codes but it was not running properly .

Upvotes: 0

Views: 520

Answers (2)

voldyman
voldyman

Reputation: 317

do you mean you have a database containing video files on your server and their description and when a user enters some key word the description is matched and when it is clicked the video should be downloaded . if yes then try the mysql table must have the following fields

+----------------------------------+
| id  | FileLocation | Description |
+----------------------------------+

make a php file which does some thing like

'Select FileLocation from table where description like %$keyword%' 

and print some thing like $id(or something)

hope it helps...

Upvotes: 0

code-zoop
code-zoop

Reputation: 7368

I am note sure I understand your problem 100%, but are you defining the correct header to download the file?

Like:

<?php
    header("Cache-Control: public");
    header("Content-Description: File Transfer");
    header("Content-Disposition: attachment; filename=someFile.mpeg");
    header("Content-Type: video/mpeg");
    .....

Upvotes: 5

Related Questions