Build a file link

Build a file link

by Andres Linares -
Number of replies: 0

Hi,

I've made a form with a filepicker on it. I need the user to select a file with it and to make a temporary direct link (url) to it. I'm needing that file to be accesible from outside the system (I mean, without authentication) but for a limited amount of time. 


In the view.php file in my module I have this:

if ($simplehtml->is_cancelled()) { 

 $courseurl = new moodle_url('/course/view.php', array('id' => $id)); redirect($courseurl); 

} else if ($contenido_formulario = $simplehtml->get_data()) { 

 $courseurl = new moodle_url('/course/view.php', array('id' => $courseid)); 

 print $simplehtml->get_new_filename('miarchivo'); 

 // I think I must do this here 

 print do_create_link_to_file( $contenido_formulario->miarchivo ); // or something like this, I think 

 //redirect($courseurl); 

 } else { 

 $site = get_site(); 

 echo $OUTPUT->header(); 

 $simplehtml->display(); echo $OUTPUT->footer(); 

}

I've already red this:

http://docs.moodle.org/dev/Using_the_File_API_in_Moodle_forms#Convert_internal_relative_links_to_absolute_links

But I really don't know if this makes what I am looking for.



Average of ratings: -