Ahaa
|
| Posted: 11/17/2004, 1:27 PM |
|
I want the FileUpload control to save uploaded files with its Original name. We have tried many Events (Before Process File, After Process File) to get Original Filename but it wasn't working.
Making changes to the Classes.php was under some supervision and it has become a real eye opener.
We changed the code below in Classes.php file (clsFileUpload class-> Upload function).
FROM:
while($file_exists) {
$ActualFileName = date("YmdHis") . $index . "." . $FileName;
$file_exists = file_exists($ActualFileName);
$index++;
TO:
while($file_exists) {
$ActualFileName = $index . "." . $FileName; // date("YmdHis") . HAS BEEN REMOVED!
$file_exists = file_exists($ActualFileName);
$index++;
I deleted the existing published directory so that newly generated files will carry over the settings from the source files.
But the weird thing (which is annoying!) is that generated Classes.php file still have the deleted line.
RE-APPEARED IN NEWLY GENERATED FILE
while($file_exists) {
$ActualFileName = date("YmdHis") . $index . "." . $FileName; // The date() function RE-APPEARED
$file_exists = file_exists($ActualFileName);
$index++;
HAS ANYONE SEEN OR EXPERIENCED SOMETHING LIKE THIS BEFORE PLEASE HELP.
Cheers,
Ahaa
|
|
|
 |
DonB
|
| Posted: 11/17/2004, 6:58 PM |
|
I suppose you want the files stored without the timestamp prefix? I suggest
you leave the Common code alone and make use of the Before Process File
event of the Upload Control. You can choose the filename you like (using
similar code as that which you were trying to modify) and substitute it for
the one CCS would otherwise generate for you.
--
DonB
http://www.gotodon.com/ccbth
"Ahaa" <Ahaa@forum.codecharge> wrote in message
news:5419bc257c171b@news.codecharge.com...
> I want the FileUpload control to save uploaded files with its Original
name. We
> have tried many Events (Before Process File, After Process File) to get
Original
> Filename but it wasn't working.
>
> Making changes to the Classes.php was under some supervision and it has
become
> a real eye opener.
>
> We changed the code below in Classes.php file (clsFileUpload class->
Upload
> function).
>
> FROM:
> while($file_exists) {
> $ActualFileName = date("YmdHis") . $index . "." . $FileName;
> $file_exists = file_exists($ActualFileName);
> $index++;
>
>
> TO:
> while($file_exists) {
> $ActualFileName = $index . "." . $FileName; // date("YmdHis") . HAS
BEEN
> REMOVED!
> $file_exists = file_exists($ActualFileName);
> $index++;
>
> I deleted the existing published directory so that newly generated files
will
> carry over the settings from the source files.
>
> But the weird thing (which is annoying!) is that generated Classes.php
file
> still have the deleted line.
>
> RE-APPEARED IN NEWLY GENERATED FILE
> while($file_exists) {
> $ActualFileName = date("YmdHis") . $index . "." . $FileName; // The
date()
> function RE-APPEARED
> $file_exists = file_exists($ActualFileName);
> $index++;
>
> HAS ANYONE SEEN OR EXPERIENCED SOMETHING LIKE THIS BEFORE PLEASE HELP.
>
> Cheers,
> Ahaa
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
Ahaa
|
| Posted: 11/17/2004, 10:46 PM |
|
After sniffing through the project code for many hours of the night looking for reasons why the generated files weren't picking modifications in the source files, I had to close the project and opened it again. And when I reopened the project again and generated new files, all modifications from the sources files appeared in the generated files ! phew.
Thanks DonB for your suggestion.
We have to start making changes to the common files when property settings weren't working. I guess if we had closed and reopend the project again there wouldn't be a need to go that far. Anyway, we never stop learning!
Cheers
Ahaa
Quote Ahaa:
I want the FileUpload control to save uploaded files with its Original name. We have tried many Events (Before Process File, After Process File) to get Original Filename but it wasn't working.
Making changes to the Classes.php was under some supervision and it has become a real eye opener.
We changed the code below in Classes.php file (clsFileUpload class-> Upload function).
FROM:
while($file_exists) {
$ActualFileName = date("YmdHis") . $index . "." . $FileName;
$file_exists = file_exists($ActualFileName);
$index++;
TO:
while($file_exists) {
$ActualFileName = $index . "." . $FileName; // date("YmdHis") . HAS BEEN REMOVED!
$file_exists = file_exists($ActualFileName);
$index++;
I deleted the existing published directory so that newly generated files will carry over the settings from the source files.
But the weird thing (which is annoying!) is that generated Classes.php file still have the deleted line.
RE-APPEARED IN NEWLY GENERATED FILE
while($file_exists) {
$ActualFileName = date("YmdHis") . $index . "." . $FileName; // The date() function RE-APPEARED
$file_exists = file_exists($ActualFileName);
$index++;
HAS ANYONE SEEN OR EXPERIENCED SOMETHING LIKE THIS BEFORE PLEASE HELP.
Cheers,
Ahaa
|
|
|
 |
|