Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
IRHM73  
#1 Posted : Saturday, March 17, 2012 10:33:56 AM(UTC)
IRHM73

Rank: Member

Groups: Member
Joined: 2/13/2012(UTC)
Posts: 21

Thanks: 1 times
I wonder whether someone may be able to help me please.

I've put together the code below which generates a page allowing a user to view the folders and associated image files which they've uploaded.


Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?php 
  //This variable specifies relative path to the folder, where the gallery with uploaded files is located.
  $galleryPath = 'UploadedFiles/';
  
  $absGalleryPath = realpath($galleryPath) . DIRECTORY_SEPARATOR;
  
  $descriptions = new DOMDocument('1.0');
  $descriptions->load($absGalleryPath . 'files.xml');
  
  $items = array();
  
  for ($i = 0; $i < $descriptions->documentElement->childNodes->length; $i++) {
    $xmlFile = $descriptions->documentElement->childNodes->item($i);
    $path = $xmlFile->getAttribute('name');
    $path = explode('/', $path);
    
    $t = &$items;
    for ($j = 0; $j < count($path); $j++) {
      if (empty($t[$path[$j]])) {
        $t[$path[$j]] = array();
      }
      $t = &$t[$path[$j]];
    }
    $t['/src/'] = $xmlFile->getAttribute('source');
    $t['description'] = $xmlFile->getAttribute('description');
    $t['size'] = $xmlFile->getAttribute('size');
  }
  
  $basePath = empty($_GET['path']) ? '' : $_GET['path'];
  if ($basePath) {
    $basePath = explode('/', $basePath);
    for ($j = 0; $j < count($basePath); $j++) {
      $items = &$items[$basePath[$j]];
    }
  }
  
  $files = array();
  $dirs = array();
  
  function urlpartencode(&$item, $index) {
    $item = rawurlencode($item);
  }
  
  foreach ($items as $key => $value) {
    if (isset($value['/src/'])) {
      $value['/src/'] = explode('/', $value['/src/']);
      array_walk($value['/src/'], 'urlpartencode');
      $value['/src/'] = implode('/', $value['/src/']);
      $files[] = array(
        'name' => $key,
        'src' => $value['/src/'],
        'description' => htmlentities($value['description'], ENT_COMPAT, 'UTF-8'),
        'size' => htmlentities($value['size'], ENT_COMPAT, 'UTF-8')
      ); 
    } else {
      $dirs[] = $key;
    }
  }
  
  $basePath = empty($_GET['path']) ? '' : $_GET['path'];
  $up = dirname($basePath);
  if ($up == '.') {
    $up = '';
  }
  
  sort($files);
  sort($dirs);
?>
<head>
  <title>View Image Folders</title> 
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <link href="Styles/style.css" rel="stylesheet" type="text/css" />
  <script src="Libraries/jquery/jquery-1.4.3.min.js" type="text/javascript"></script>
  <style type="text/css">
<!--
.style1 {
	font-size: 14px;
	margin-top: 5px;
	margin-right: -50px;
}

-->
  </style>
<body style="font-family: Calibri; color:  #505050; margin-right: 160px; margin-left: -180px;">
<div align="right" class="style1"> <a href = "index.php" /> Add Images <a/> &larr; View Uploaded Images In Folder Structure &rarr; <a href = "gallery.php" /> View All Uploaded Images </a></div>
<form id="viewimagefolders" name="viewimagefolders" class="page">
   <div id="container">
  </div>
    <div id="center">
      <div class="aB">
        <div class="aB-B">
          <?php if ('Uploaded files' != $current['title']) :?>
          <?php endif;?>
          <input name="userid" type="text" id="userid" value="1" />
          <input name="locationid" type="text" id="locationid" value="1" />
<div class="demo">
            <div class="inner">
              <div class="container">
                <div class="gallery">
                  <table class="gallery-link-table" cellpadding="0" cellspacing="0">
                    <thead>
                      <tr class="head">
                        <th class="col-name">
                          Name                        </th>
                        <th class="col-size">
                          Size                        </th>
                        <th class="col-description">
                          Description                        </th>
                        <th class="col-description">&nbsp;</th>
                      </tr>
                    </thead>

                    <tbody>
                      <tr class="directory odd">
                        <td class="col-name">
                          <a href="?path=<?php echo rawurlencode($up); ?>">..</a>                        </td>
                        <td class="col-size">                        </td>
                        <td class="col-description">                        </td>
                        <td class="col-description"></td>
                      </tr>
                      <?php $i = 1; ?>
                      <?php foreach ($dirs as $dir) : ?>
                      <tr class="directory <?php $i++; echo ($i % 2 == 0 ? 'even' : 'odd'); ?>">
                        <td><a href="?path=<?php echo rawurlencode(($basePath ? $basePath . '/' : '') . $dir); ?>"><?php echo htmlentities($dir, ENT_COMPAT, 'UTF-8'); ?></a></td>
                        <td>Folder</td>
                        <td></td>
                        <td><input name="delete" type="button" id="delete" value="Delete Folder" /></td>
                      </tr>
                      <?php endforeach; ?>
                      <?php foreach ($files as $file) : ?>
                      <tr class="<?php $i++; echo ($i % 2 == 0 ? 'even' : 'odd'); ?>">
                        <td><a target="_blank" href="<?php echo $galleryPath . $file['src']; ?>"><?php echo htmlentities($file['name'], ENT_COMPAT, 'UTF-8'); ?></a></td>
                        <td><?php echo htmlentities($file['size'], ENT_COMPAT, 'UTF-8'); ?></td>
                        <td><?php echo htmlentities($file['description'], ENT_COMPAT, 'UTF-8'); ?></td>
                        <td><label></label></td>
                      </tr>
                      <?php endforeach; ?>
                    </tbody>
                  </table>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
  </div>
        </div>
        <div class="aB-a"></div>
      </div>
    </div>
</form>
</body>
</html>


I'm now trying to find a way in which a user can delete a folder, and a file within a folder. I've added the appropriate buttons to the forms, but I've been searching for a 'Delete Files' class which would allow me to implement a 'onclick' event but I haven't been able locate this.

The nearest that I have found is 'EnableOriginalFilesDeletion' but from what I've read and been able to implement, this class is only available on a 'file upload'.

I just wondered whether someone could perhaps offer some guidance or confirm whether there is a way of deleting files through the Image Uploader software that I may have missed.

Many thanks
Dmitry.Obukhov  
#2 Posted : Monday, March 19, 2012 12:02:48 AM(UTC)
Dmitry.Obukhov

Rank: Advanced Member

Groups: Member
Joined: 5/29/2010(UTC)
Posts: 1,310

Thanks: 8 times
Was thanked: 111 time(s) in 111 post(s)
Hello Chris,

Please let me clarify some things. Image uploader is designed to only transfer files from client computers to a server. Of course the uploader has many features which can be enabled (creating thumbnails, adding watermark and etc.) to get required needs but not more. Image Uploader does not control uploaded files and does not show them on the gallery page. To show uploaded images on the gallery page, you needed to implement a separated script. There is the same way with deleting images from the gallery. You will need to implement your own code which allows you to get it.
Best regards,
Dmitry Obukhov
Technical Support. Aurigma, Inc.
IRHM73  
#3 Posted : Monday, March 19, 2012 3:03:46 AM(UTC)
IRHM73

Rank: Member

Groups: Member
Joined: 2/13/2012(UTC)
Posts: 21

Thanks: 1 times
Hi Dmitry, apologies,

Many thanks for taking the time to reply to my post.

Kind regards

Chri
Dmitry.Obukhov  
#4 Posted : Monday, March 19, 2012 6:42:37 PM(UTC)
Dmitry.Obukhov

Rank: Advanced Member

Groups: Member
Joined: 5/29/2010(UTC)
Posts: 1,310

Thanks: 8 times
Was thanked: 111 time(s) in 111 post(s)
It is okay, Chris. Aurigma support team assists with questions and problems related to our software (Image Uploader, Graphics Mill and etc) only. You can post your other questions on these forums:
Best regards,
Dmitry Obukhov
Technical Support. Aurigma, Inc.
IRHM73  
#5 Posted : Tuesday, March 20, 2012 3:17:48 AM(UTC)
IRHM73

Rank: Member

Groups: Member
Joined: 2/13/2012(UTC)
Posts: 21

Thanks: 1 times
Thanks Dmitry.
Users browsing this topic
Similar Topics
Cannot Delete Files After Uploading (Image Uploader)
by TooAural 3/8/2007 1:41:48 PM(UTC)
ShowStatusPane and Remove Delete Files Button (Image Uploader)
by PhotoshopGod 12/31/2006 1:03:18 PM(UTC)
Delete files on Safari? (Discussions – ActiveX/Java Uploader)
by codesmith 7/8/2005 7:40:00 AM(UTC)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.