CCS_newbie
Posts: 6
|
| Posted: 03/24/2009, 9:02 PM |
|
hi.
Like the title says itself. I'm having problems trying to avoid to get the full filename generated by CCs while uploading as: date("YmdHis").filename.extension
I already checked some solutions in this forum, but no one worked for me.
First, I prefer not touching the Classes.php code. (it re-generate itself as original)
Second, I already try the "Get original Filename" event = Before, After, etc. all combinations, from grid and from uploader component. Never worked, get some errors: "The file filename.mp3 specified in upload was not found.", and still upload the file with complete TIMESTAMP.
So, I just want to upload the original filename because some users download my uploaded audio files and when they want to organize them, let's say in itunes, they have to see all the filename like: 200902221854500.filename.mp3
So, please, somebody could help me here?
Thanks 
|
 |
 |
datadoit
|
| Posted: 03/25/2009, 8:52 AM |
|
FileUpload Component AfterProcessFile, add Custom Code:
$old = $Component->GetValue();
$new = "MyFileName.pdf";
if (file_exists($new)) {
unlink($new);
}
rename($old, $new);
Now there are a lot of other things you should do with this, such as
retrieving the file extension, file folder, etc. etc. But you get the jist.
|
|
|
 |
CCS_newbie
Posts: 6
|
| Posted: 03/25/2009, 9:50 PM |
|
Quote datadoit:
$new = "MyFileName.pdf";
hi, thanks a lot your interest in helping me.
sorry my ignorance, i'm not a coder. But, could you be more specific about what exactly do i have to type as a filename variable?
is this correct?:
$new = $FileName;
instead of:
$new = "MyFileName.pdf";
Besides, anyhow, I got this error message after process a file upload.
++++++++++++++++++++++++++
Warning: rename(200903252052160.whateverfilename.mp3,) [function.rename]: No such file or directory in /home1/user/public_html/web/audio_a_events.php on line 29
Warning: Cannot modify header information - headers already sent by (output started at /home1/user/public_html/web/audio_a_events.php:29) in /home1/user/public_html/web/audio_a.php on line 1305
+++++++++++++++++++++
And after that, refreshing the last page (where the upload component is) I see that the file was uploaded after all, but including the TIMESTAMP again.
Could you give me a hand, please?
Thanks.
|
 |
 |
melvyn
Posts: 333
|
| Posted: 03/25/2009, 10:01 PM |
|
MyFileName.pdf was just an example. We don't know what the name you want to put.
Let's say you extract the original filename as
$MyFileName = "Get Original Filename" action; // do it, you did.
$new = $MyFileName; // which is (of course) the name you want to use.
_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com |
 |
 |
|