Commit 7ef35501 authored by Clément Démoulins's avatar Clément Démoulins
Browse files

Save original uploaded filename.

parent e5172662
......@@ -129,6 +129,8 @@ class FileManager
{
if (!$this->is_valid_example_file())
exit(1);
// Has a valid example selected.
return $this->get_last_filename_from_example();
}
else // !$session->has_example_selected()
......@@ -154,6 +156,7 @@ class FileManager
// Update last filename information.
$session->set_last_filename($input);
$session->set_last_original_filename($this->get_original_uploaded_filename());
return $input;
}
......
......@@ -24,22 +24,35 @@ class SessionManager
return $_SESSION['ID'];
}
public function last_original_filename()
{
if (isset($_SESSION['last_original_filename']))
return $_SESSION['last_original_filename'];
else
return "";
}
public function set_last_original_filename($name)
{
$_SESSION['last_original_filename'] = $name;
}
public function last_filename()
{
if (isset($_SESSION['original_name_lastfile']))
return $_SESSION['original_name_lastfile'];
if (isset($_SESSION['last_local_filename']))
return $_SESSION['last_local_filename'];
else
return "";
}
public function set_last_filename($name)
{
$_SESSION['original_name_lastfile'] = $name;
$_SESSION['last_local_filename'] = $name;
}
public function unset_last_filename()
{
unset($_SESSION['original_name_lastfile']);
unset($_SESSION['last_local_filename']);
}
public function unset_current_demo()
......@@ -83,7 +96,7 @@ class SessionManager
unset($_SESSION['EXAMPLE_ID']);
unset($_SESSION['EXAMPLE_DIR']);
unset($_SESSION['EXAMPLE_FILE']);
//unset($_SESSION['original_name_lastfile']);
//unset($_SESSION['last_local_filename']);
// FIXME: unset last_filename too ?
$this->clear_last_results();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment