Hello StackOverflow Community,
I want to be able to echo that a file is uploaded in upload/FirstName_LastName_FileName.ext
format. In my PHP file, I have this HTML here:
<td>File Stored in:</td>
<td>upload/$uploadName_$filename</td>
but it seems that this code returns upload/$filename
. How can I remedy this situation? I'm very new to this so help is greatly appreciated!
EDIT: I was too hasty in trying to get this question answered that I didn't provide enough information. I actually could not use the PHP tags since it was going to be embedded into the message of the mail function. So I found a way by assigning a new variable $uploadPath
to the code. The line now looks lke this:
$uploadPath = "upload/" . $uploadName . "_" . $filename;
// mail to, subject, message and its table...
<td>File Stored in:</td>
<td>$uploadPath</td>
Even still, thank you all for your quick answers! I gave the fastest the checkmark.
There's a lot of ways to do this. Here's a few:
<td>upload/<?= $uploadName,'_',$filename; ?></td>
<td>upload/<?= $uploadName.'_'.$filename; ?></td>
<td>upload/<?php printf("%s_%s", $uploadName, $filename; ?></td>
<td>upload/<?= $uploadName; ?>_<?= $filename; ?></td>
<td>upload/<?= "{$uploadName}_{$filename}"; ?></td>
Use php tags:
<td>File Stored in:</td>
<td>upload/<?php echo $uploadName?>_<?php echo $filename?></td>
试试这个代码:
<td><?php echo 'upload/' . $uploadName . '_' . $filename; ?>**strong text**</td>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.