Hi everybody!
Im having trouble doing this task hope someone could help.
I still working on my project/app where user can upload a file a server, that then provide him with the link that can be shared for a certain period of time.
I want, using <option> tag, to make a user select the max time that he would like to share the image. For example when the user select 30 minutes, the php file get the server time, and then plus 30 minutes unlink/delete the file from database. (thats my idea). Im having problem with it.
I leave you with this code so far! The problem its obvious on time function.
_Display the option____
_And this is my code so far, but obviously with many mistakes______
Im having trouble doing this task hope someone could help.
I still working on my project/app where user can upload a file a server, that then provide him with the link that can be shared for a certain period of time.
I want, using <option> tag, to make a user select the max time that he would like to share the image. For example when the user select 30 minutes, the php file get the server time, and then plus 30 minutes unlink/delete the file from database. (thats my idea). Im having problem with it.
I leave you with this code so far! The problem its obvious on time function.
_Display the option____
Code:
<?
function delete_file(){
$tempo = array ("+30 minutos", "+1 hora");
echo '<select name="tempo">';
foreach ($tempo as $key =>$value){
echo "<option id='select_expire' value=\"$key\" >$value</option>\n";}
echo'</select>';
}//ende of the function
//call the form taga:
echo '<label for="select_expire">Escolhe o expire time:</label>';
//call the function
delete_file();
?>
_And this is my code so far, but obviously with many mistakes______
Code:
<?
if (isset($tempo['30 minutes'])){
$file = $user_file;
$expire = $time + 30;
$time = time();
unlink($file);}
?>
Comment