473,504 Members | 13,830 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

buid filename with concatenation

30 New Member
Hi

I need to click on a button that will download a file.
The problem is how I will indicate a filename.

Files are stored in folders tcp20100220,tcp20100220.
It depends on a date given by the user.The file in the folder will be named in the same way but will be a pdf file.(tcp20100220.pdf)

1 .A form is given to the user where he/she enters a date.Then a file is generated in the specific folder.
2. A new html page opens with a download button.

My problem:
Button is html.

The date is received into php as follow

Expand|Select|Wrap|Line Numbers
  1. $indate=$_POST["inputdate"];
  2. echo " indate is".$indate;  
  3. //ghet input date
  4. if (isset($_POST["inputdate"])){ 
  5. $MyToday=date("Ymd");
  6. $MyToday=strtotime($indate);}
  7. else{
  8. $MyToday=$today;}
  9. echo"..."; 
  10.  
now the download button cannot be created in php so I need to use Html.

Something like the following should be done

Expand|Select|Wrap|Line Numbers
  1. <html> 
  2. <title>HTML with PHP</title>
  3. <body>
  4.  
  5. <input type="button" value="Download Result" onClick="window.location.href='http://111.111.11.117/besa/SASoutput/tcp"<?php date('Ymd',$MyToday) ?>>/tcp"<?php date('Ymd',$MyToday) ?>>.pdf">
  6. </html>
  7.  
Please give me some direction as you can see I have no idea how to go ahead.
Sep 28 '10 #1
3 1370
johny10151981
1,059 Top Contributor
if you had search before posting you would get result both on google and in this forum
follow the link
Sep 28 '10 #2
Tinus
30 New Member
Thank you.
So if I have a file in C:\aptana\xampp-win32-1.7.3\xampp\htdocs\besa\RD_Env_ICV5\Report\MtM_Bon d_20100826
named TRI_FP20100826.pdf

Why is the following giving me the message "file missing in the server"

Expand|Select|Wrap|Line Numbers
  1. $thedate="20100826"
  2. if
  3.  (file_exists("C:/aptana/xampp-win32-1.7.3/xampp/htdocs/besa/RD_Env_ICV5/Report/MtM_Bond_".$thedate."/"."TRI_FP".$thedate."pdf")==false) 
  4.  { 
  5.   echo "<message>file missing in the server</message>";  
  6.   exit; 
  7.  } 
  8.  
I know this might be another stupid question but I have a deadline and this neads to be finished in time.
Sep 29 '10 #3
johny10151981
1,059 Top Contributor
Expand|Select|Wrap|Line Numbers
  1. file_exists("C:/aptana/xampp-win32-1.7.3/xampp/htdocs/besa/RD_Env_ICV5/Report/MtM_Bond_".$thedate."/"."TRI_FP".$thedate."pdf"
this has a bug. the bug is there is "." before pdf

last 4 bytes of the file name is ".pdf" but you are checking for "6pdf"
Sep 29 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

17
610
by: Leif B. Kristensen | last post by:
Having recently started with Python, I've written this little function to retrieve place parts from a database and concatenate them to a string. While it certainly works, and is also considerably...
7
8018
by: Paul Davis | last post by:
I'd like to overload 'comma' to define a concatenation operator for integer-like classes. I've got some first ideas, but I'd appreciate a sanity check. The concatenation operator needs to so...
4
993
by: colonel | last post by:
I am new to python and I am confused as to why when I try to concatenate 3 strings, it isn't working properly. Here is the code: ...
24
3533
by: Caroline | last post by:
The following is not working int num = 0, char *string; string = "qwerty"; strcpy(string, num); strcpy(string, ".png");
33
4634
by: genc_ymeri | last post by:
Hi over there, Propably this subject is discussed over and over several times. I did google it too but I was a little bit surprised what I read on internet when it comes 'when to use what'. Most...
10
5745
by: byrd48 | last post by:
Hi, I haven't had much luck searching for guidance on the following challenge. I have a .NET app in which I would like to take multiple thumnail images and combine them into one flat image....
34
2616
by: Larry Hastings | last post by:
This is such a long posting that I've broken it out into sections. Note that while developing this patch I discovered a Subtle Bug in CPython, which I have discussed in its own section below. ...
5
2181
by: Edwin Smith | last post by:
Hello: I have a problem building a file command line argument from 2 cells in a table with the following code. string filePath =...
34
3488
by: raylopez99 | last post by:
StringBuilder better and faster than string for adding many strings. Look at the below. It's amazing how much faster StringBuilder is than string. The last loop below is telling: for adding...
6
4437
by: vijayarl | last post by:
Hi Everyone, i need to add a string in between the filename.so that new file will have the required filename. what am doing is reading the files from the directory & extract only the filename...
0
7213
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7298
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4698
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1526
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
406
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.