File Extension Problem
Posted: Thu Apr 18, 2002 5:32 pm
I have created a system which allows users to upload files to file storage via a web interface. A administrator is then able to download the file via the same interface. The details of the file are automatically entered into the database. Filename, filetype etc.
Just so that no two files of the same filename can be added to the filestorage, I am renaming the file upon submission. The new file will now consist of the module they are submitting to AND add a timestamp. For example: - builder.doc after submission is converted to computing-100312323.
My problem is that word documents and all non-html files now loose their extensions and my browser attempts to download them as text files!
Any suggestions as to how to tweak my code to stop this?
Here is an extract of the code that handles the creation and storage of the file to be submitted. If you need any more of it, please let me know. Its quite a few lines so i have pasted the most important part of it.
********************************************************
$timestamp = time();
$filedir = "/program files/apache group/apache/htdocs/sis/primary/final/files/work/";
$filenamenew = strtolower(str_replace(" ", "", $module_title)) . "-" . $timestamp;
$filestore = $filedir . $filenamenew;
*********************************************************
Thanks for your help in this
-Abi
Just so that no two files of the same filename can be added to the filestorage, I am renaming the file upon submission. The new file will now consist of the module they are submitting to AND add a timestamp. For example: - builder.doc after submission is converted to computing-100312323.
My problem is that word documents and all non-html files now loose their extensions and my browser attempts to download them as text files!
Any suggestions as to how to tweak my code to stop this?
Here is an extract of the code that handles the creation and storage of the file to be submitted. If you need any more of it, please let me know. Its quite a few lines so i have pasted the most important part of it.
********************************************************
$timestamp = time();
$filedir = "/program files/apache group/apache/htdocs/sis/primary/final/files/work/";
$filenamenew = strtolower(str_replace(" ", "", $module_title)) . "-" . $timestamp;
$filestore = $filedir . $filenamenew;
*********************************************************
Thanks for your help in this
-Abi