heffersj
Posts: 2
|
| Posted: 01/13/2011, 1:03 PM |
|
My employer want to place pdf files on the web server and have users select the pdf file that they want to view. I can place a list of available files into mysql. Is there a way to trun this into a selectable screen that will work?
_________________
James Heffers |
 |
 |
Rick
Posts: 52
|
| Posted: 01/14/2011, 5:55 AM |
|
A couple of options that could work depending on your needs:
Option 1: Use upload control to upload the pdf files to your server. This way you could manage the pdf files as needed. For example, you could delete/replace the pdf as needed.
Use a database field and use code to build the Web file link to display to the user with a grid. Or, you could create the link in your code at each request using the before show row event.
Option 2: Simply display an existing list of files directly from the Web Server Directory where the pdf files were placed, formatted as a link.
This link may give you an idea how to do this: http://www.howtogeek.com/howto/programming/php-display-...in-a-directory/
Of course doing it that way you would still have to manage the files, either thru the Upload process or directly at the file/directory level.
Of course there may be other options and approaches depending on your needs.
Hope this helps.
- Rick
|
 |
 |
heffersj
Posts: 2
|
| Posted: 01/14/2011, 12:22 PM |
|
I want to go with option 2. I think this is the area I need to work on.
<!-- BEGIN Row -->
<tr class="Row">
<th scope="row">Document</th>
<td>{document} </td>
</tr>
<!-- END Row -->
So, how do i make <td>{document} </td> into a url?
The address would be www.mysite.com/board/jan.pdf launched as a new page?
I tried several times and cannot get the correct syntax. Or, I'm doing it in the wrong part of project?
_________________
James Heffers |
 |
 |
damian
Posts: 838
|
| Posted: 01/21/2011, 10:50 PM |
|
right click label and change to link
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
raknuth
Posts: 67
|
| Posted: 02/02/2011, 3:53 PM |
|
Hi. Faced with a similar need, I decided to create a standalone PHP page with a File Upload control at the top and a list of files to read or delete at the bottom. I then created a button on one of the pages created with CCS to open this page.
Here is the part of the page that reads the folder on the web server and presents a list of hyperlinked files. Please note that the code contains a checkbox next to each file, allowing a user to select files for deletion. You can remove the references to the checkboxes and rename the array.
----------
<form action="bannerImageDelete.php" method="post">
<table style="width: 100%; text-align: left">
<?
$deleteFiles = array();
$i = 0;
$dir = "../images/banners";
$dh = opendir($dir);
while (($file = readdir($dh)) !== false) {
if ($file != "." && $file != "..") {
$deleteFiles[] = array($i, $file);
echo "<tr>";
echo "<td style=\"width: 35%\"> </td>";
echo "<td style=\"width: 5%\"><input type=\"checkbox\" name=\"checkbox[]\" value=\"".$deleteFiles[$i][1]."\"></td>";
echo "<td style=\"width: 60%\"><a href=\"../images/banners/".$deleteFiles[$i][1]."\" target=\"_blank\">".$deleteFiles[$i][1]."</td>";
echo "</tr>";
$i++;
}
}
closedir($dh);
?>
<tr><td colspan="3"> </td></tr>
<tr><td colspan="3" style="text-align: center"><input type="submit" value="Delete Files"></td></tr>
</table>
</form>
----------
Hope this helps.
|
 |
 |
CodeChargeMVP
Posts: 473
|
| Posted: 02/03/2011, 4:46 AM |
|
This thread comes handy,
I have just added a file upload component to our record,
I have realise than when the required option is set to No,the component by uploading is hide and then a delete checkbox appear instead and is not possible to upload a new file,
is this behaviour the normal one?
On the other hand, if I set the required option to Yes I m able to upload more files but the delete checkbox is hide,so the end user is not able to delete the uploaded file
Is this behaviour also normal?
There´s also another problem, when trying uploading a pdf file of 6mb weight nothing happens, no error message or anything,
but uploading an smart jpg file works great.
The limit capacity is set to 10.000.000 (without the dots).
I understand than 10000000 = 10mb
¿any sugestion?
Thank you very much in advance.
_________________
Best Regards
Entrepeneur | NT Consultant
|
 |
 |
damian
Posts: 838
|
| Posted: 02/03/2011, 3:54 PM |
|
Quote CodeChargeMVP:I have realise than when the required option is set to No,the component by uploading is hide and then a delete checkbox appear instead and is not possible to upload a new file,
is this behaviour the normal one?
it is normal behaviour if the record you are editing already has a file uploaded. at the db end you have room in the table field for one filename - it is already occupied. if you want to replace it you first delete the existing record and then access teh record again to upload a new one.
Quote :On the other hand, if I set the required option to Yes I m able to upload more files but the delete checkbox is hide,so the end user is not able to delete the uploaded file
Is this behaviour also normal?
it is normal behaviour. the field requires a value. if you select delete and do not add a new record then you are not complying with the required rule.
so - when you upload a new file - it also deletes the old file :)
Quote :There´s also another problem, when trying uploading a pdf file of 6mb weight nothing happens, no error message or anything,
but uploading an smart jpg file works great.
The limit capacity is set to 10.000.000 (without the dots).
I understand than 10000000 = 10mb
there are a few things - have you set the allowed or disllowed file mask in the upload component?
your server may also have a limit on what size files can be uploaded - check php.ini or htaccess - many hosted environments will have a default setting.
its possible there may be a file name issue - have you tried naming file without spaces and with alphanumerics and a . only? have you tried other pdf files?
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
|