Tengel
Posts: 49
|
| Posted: 02/10/2005, 6:12 AM |
|
As many knows filupload adds timestamp to the file name when you load it up, but what I wonder if any know how to make, so this timestamp get removed when someone do save as or save target as.
Timestamp in the file I want to have at server, but not when people want to download it, here I would like to have the org name.
_________________
---
Tengel |
 |
 |
peterr
Posts: 5971
|
| Posted: 02/10/2005, 1:04 PM |
|
You can use "Get Original Filename" action for this.
An example is in CCS Example Pack 2.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
Tengel
Posts: 49
|
| Posted: 02/10/2005, 3:45 PM |
|
IIf you think about what shown on page ( fileupload Epack 2 ) I have np problem with that.
what I was talk about is when you do save target as on the link, it will show the timestamp. not only the org file name as the link does.
_________________
---
Tengel |
 |
 |
peterr
Posts: 5971
|
| Posted: 02/10/2005, 4:16 PM |
|
You can change the code that the action created and use it to change the URL. Based on the documentation "<control>->SetLink(url)" should work.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
Tengel
Posts: 49
|
| Posted: 02/10/2005, 6:44 PM |
|
Thanks alot
_________________
---
Tengel |
 |
 |
mulan24
Posts: 6
|
| Posted: 02/28/2005, 9:05 PM |
|

the first problem is setle but now appear the second problem.
i already use the fileupload as Examples pack2 but how to avoid the timestamp?
i have a problem to open the file upload because when i click the link it appear localhost page may be bacause of timestamp. it suppose to appear pop up windows to open,save or cancel.
some say that it should set the application to intepret the file upload but i don't know where to set it.
|
 |
 |
Nicole
Posts: 586
|
| Posted: 03/01/2005, 2:59 AM |
|
Tengel,
CCS Help includes the ASP sample code for download link, but PHP code is similar one, so please read the "GetOriginFileName Method" article first (http://docs.codecharge.com/studio/html/Components/Methods/ASP/GetOriginFileName.html?toc)
The relevant PHP code utilizes GetFileName() function that returns a file name without timestamp
global $form_name;
if ($form_name->FileUpload1->Value)
{
$form_name->download_link->Page = $form_name->FileUpload1->Value;
$form_name->download_link->Value = "download ". $form_name->FileUpload1->GetFileName() . "[". $form_name->FileUpload1->GetFileSize(). "]";
}
_________________
Regards,
Nicole |
 |
 |
Tengel
Posts: 49
|
| Posted: 03/08/2005, 4:44 AM |
|
My way to do this was this
$db = new clsDBinternet();
$file_id = CCGetParam("file_id", "");
$dir ="files/";
$file_name = CCDLookUp("file_name", "files","file_id=$file_id".$db->ToSQL(CCGetUserID(),ccsInteger), $db);
$file = ($dir.$file_name);
$control_value = CCDLookUp("file_name", "files","file_id=$file_id", $db);
if (preg_match("/^\d{14,}\./", $control_value)) {
$original_filename = preg_replace("/^\d+\./", "", $control_value);}
if (!file_exists($file))
{ die ("File does not exist");}
header("Content-Length: " . filesize($file));
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"$original_filename\"");
header("Content-Transfer-Encoding: binary");
readfile($file);
This hide real url of the file, but also get the org name at save.
But I have one problem with this yet, and this is how to add ext url to the script?
If I use
$dir ="http://my.url.com/files/";
I only get file does not exsist, even I know it does.
So how to make a ext url make work?
_________________
---
Tengel |
 |
 |
|