CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 download files

Print topic Send  topic

Author Message
kirchaj

Posts: 215
Posted: 05/11/2006, 6:59 AM

I am creating an application that will allow users to upload files into a personal user directory (/var/www/portfolio/xxxxxxxxx) where the xxxxxxxxx is the UserID. I do not want this directly accessible from a web browser and thought this would be more secure.

Uploading is working just fine. I can specify the dirctory path before upload. But I have been unable to get the file download to work. I have checked the threads like this one

http://forums.codecharge.com/posts.php?post_id=45527 and still do not know how to set the path correctly to make the download work.

Any suggestions would be appreciated.

TK
View profile  Send private message
peterr


Posts: 5971
Posted: 05/11/2006, 11:48 AM

In your case it may be best to build the URL programmatically. Just use a label with the Before Show event where you assemble the necessary HTML code, like:
$FormName->Label1->SetValue("<a href="http://www.yessoftware.com/download/files/CCStudio3_0_4_1.exe">Click Here to Download</a>");

_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
kirchaj

Posts: 215
Posted: 05/12/2006, 10:36 AM

Peter,

Thanks for the help. I have made a few changes and moved directories around to make this work.

I am trying to progammatically create the url with little luck and I am sure it is just my lack of knowledge. Here is my code

$server = "xxxx.xxxx.xxx";
$path = "uploads";
$user = CCgetUserID();
$stufile = $student_upload->stu_upld_filename->GetValue();

$student_upload->Link2->SetValue("<a href=http://" . $server . "/" . $path . "/" . $stufile ">Click Here to Download</a>");

but I keep getting errors like this

Parse error: parse error in /var/www/html/portfolio/student/student_uploads_events.php on line 55

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/portfolio/student/student_uploads_events.php:55) in /var/www/html/portfolio/student/student_uploads.php on line 556


I am so close I can taste it but don't know how to get around this hurdle.

Thanks for all of your help.

TK
View profile  Send private message
peterr


Posts: 5971
Posted: 05/12/2006, 10:50 AM

Not sure what's wrong but first please check what you have on line 55 that is reported in that warning/error.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
kirchaj

Posts: 215
Posted: 05/12/2006, 10:55 AM

Sorry Peter,

I didn't indicate this in my posting. This is line 55


$student_upload->Link2->SetValue("<a href=http://" . $server . "/" . $path . "/" . $stufile ">Click Here to Download</a>");

and I cannot figure out what is wrong;

TK
View profile  Send private message
WKempees
Posted: 05/12/2006, 10:59 AM

put a single quote before http and before >
like :
  
  
$student_upload->Link2->SetValue("<a href='http://" . $server . "/" . $path   
.. "/" . $stufile ." '>Click Here to Download</a>");  
  



kirchaj

Posts: 215
Posted: 05/12/2006, 11:55 AM

WKempees,

Thanks for reply. Your solution didn't work but it got me on the right track.

Here is what worked.


$student_upload->Link2->SetValue("<a href='http://" . $server . "/" . $path . "/" . $user. "/" . $stufile ." '>Click Here to Download</a>");

I had to add an extra variable, but the format is the same.

Thanks for all the help. CodeCharge and these forums make my life a lot easier.

TK
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.