Revision history for TwoMCM
Revision [23122]
Last edited on 2016-05-20 07:38:46 by TwoMCM [Replaces old-style internal links with new pipe-split links.]Additions:
[[http://img82.imageshack.us/img82/7196/fileupload8kt.png | Screen shot of an example]] ( due to image editing problems, "Standard file embed" has Type: and Size: duplicated ).
Blob ( as i have called it ) is [[Wikipedia:SHA1 | hash]] orientated. The three modes for displaying the file are :
Blob ( as i have called it ) is [[Wikipedia:SHA1 | hash]] orientated. The three modes for displaying the file are :
Deletions:
Blob ( as i have called it ) is [[Wikipedia:SHA1 hash]] orientated. The three modes for displaying the file are :
No Differences
Additions:
[[http://img82.imageshack.us/img82/7196/fileupload8kt.png Screen shot of an example]] ( due to image editing problems, "Standard file embed" has Type: and Size: duplicated ).
=====If you want to contact me use [[[email protected]]]=====
=====If you want to contact me use [[[email protected]]]=====
Deletions:
=====If you want to contant me use [[[email protected]]]=====
Additions:
=====If you want to contant me use [[[email protected]]]=====
I doubt if i will be visting this page often.
I doubt if i will be visting this page often.
Additions:
[[http://img82.imageshack.us/img82/7196/fileupload8kt.png Screen shot of an example.]]
Additions:
=====twomcm's user page=====
Additions:
- The first, which i call 'blob', allows you to upload files ( up to 1 MiB (MySQL packet limit)) to a wikka powered site. As well, you can embed images into pages, create a link to the file, or show a description ( incl of view/download link ). It uses two files but the action file is all that is required if you only wish to upload or show the description view for files.
- The second ( base64.php ) allows small files to be embeded into a page if they are base64 encoded ( not really suggested to be used ).
Blob ( as i have called it ) is [[Wikipedia:SHA1 hash]] orientated. The three modes for displaying the file are :
- The second ( base64.php ) allows small files to be embeded into a page if they are base64 encoded ( not really suggested to be used ).
Blob ( as i have called it ) is [[Wikipedia:SHA1 hash]] orientated. The three modes for displaying the file are :
Deletions:
- The second allows small files to be embeded into a page if they are base64 encoded ( not really suggested to be used ).
Blob ( as i have called it ) is [[Wikipedia:SHA1 hash]] orientated. The three modes for display the file are :
Additions:
=====Blob details :=====
Blob ( as i have called it ) is [[Wikipedia:SHA1 hash]] orientated. The three modes for display the file are :
1) **Description.** This gives a box with the file's details and allows has view and download buttons. Exmaple code : ""{{blob hash="SHA1 SUM"}}""
1) **Image embed**. This inserts the image as ##<img src="yadadad" />##. Also 'wrapped' with an ##<a href=" "></a>## pointing to the same URL as the img src. Requires the handerler file installed and the file's type must start with 'image' ( e.g. image/png). Example code : ""{{blob hash="SHA1 SUM" type="image"}}""
1) **Image with border**. Same as above but with a border ( using class="border" ). Example code : ""{{blob hash="SHA1 SUM" type="image_wb"}}""
1) **Link**. Just the file name wrapped with a ##<a href=" ">## pointing to the file's view URL.
----
----
----
Blob ( as i have called it ) is [[Wikipedia:SHA1 hash]] orientated. The three modes for display the file are :
1) **Description.** This gives a box with the file's details and allows has view and download buttons. Exmaple code : ""{{blob hash="SHA1 SUM"}}""
1) **Image embed**. This inserts the image as ##<img src="yadadad" />##. Also 'wrapped' with an ##<a href=" "></a>## pointing to the same URL as the img src. Requires the handerler file installed and the file's type must start with 'image' ( e.g. image/png). Example code : ""{{blob hash="SHA1 SUM" type="image"}}""
1) **Image with border**. Same as above but with a border ( using class="border" ). Example code : ""{{blob hash="SHA1 SUM" type="image_wb"}}""
1) **Link**. Just the file name wrapped with a ##<a href=" ">## pointing to the file's view URL.
----
----
----
Additions:
- The second allows small files to be embeded into a page if they are base64 encoded ( not really suggested to be used ).
Deletions:
Additions:
These are two Wikka modules i have written.
- The first, which i call 'blob', allows you to upload files ( up to 1 MiB (MySQL limit of packet )) to the wikka powered site. As well you can embed the file into pages, create a link to the file, or show a description ( incl of view/download link ). It uses two files but the action file is all that is required if you only wish to upload or show the description of the files.
- The second allows small files to be embeded into a page if they are base64 encoded
Enjoy.
Any comments would be appreciated.
Since i do not have access to Internet Exploder YMMV if you are accessing these page with //that// browser.
##/action/blob.php##
1.3 Image + link
1.2 Changed so that it will only allow uploads if the user has R/W to the page.
Image
{{blob hash="SHA1 SUM" type="image"}}
link
{{blob hash="SHA1 SUM" type="link"}}
if(strtolower($vars['type']) == 'link'){
echo "<a href=\"".$this->href('blob',$this->GetPageTag(),'action=view&hash='.$row['hash'])."\">";
echo "{$row['name']}";
echo "</a>";
}elseif(strtolower($vars['type']) == 'image'){
echo "<a href=\"".$this->href('blob',$this->GetPageTag(),'action=view&hash='.$row['hash'])."\">";
echo " <img src=\"".$this->href('blob',$this->GetPageTag(),'action=view&hash='.$row['hash'])."\" />";
echo "</a>";
}else{
echo $this->FormOpen();
echo "<div class=\"code\">\n";
echo "Filename: ".$row['name']."<br />\n";
echo "Type: ".$row['type']."<br />\n";
echo "Size: ".$row['size']." Bytes<br />\n";
echo "</div>\n";
echo '<input type="hidden" name="blob_sha1" value="'.$row['hash']."\" />\n";
echo '<input type="submit" name="download" style="line-height:10px;float:right;'.
'vertical-align:middle;margin-right:20px; margin-top: 0px; font-size: 10px; '.
'color:#000; font-weight: normal; font-family: Verdana, Arial, sans-serif; background-color: #DDD;'.
'text-decoration: none; height: 18px;" value="download" title="Download this item" />'."\n";
echo '<input type="submit" name="view" style="line-height:10px;float:right;'.
'vertical-align:middle;margin-right:20px; margin-top: 0px; font-size: 10px; '.
'color:#000; font-weight: normal; font-family: Verdana, Arial, sans-serif; background-color: #DDD;'.
'text-decoration: none; height: 18px;" value="view" title="View this item" />'."\n";
// FIXME remove unneeded style items
echo $this->FormClose();
if($_POST['blob_delete'] && $this->HasAccess("write") ){
if($_FILES['blob_upload']['name'] && $this->HasAccess("write") && !$_FILES['blob_upload']['error'] ){
if($this->HasAccess("write")){
echo $this->FormOpen();
echo '<input type="hidden" name="blob_sha1" value="'.$row['hash']."\" />\n";
echo '<input type="submit" name="blob_delete" style="font-size: 9px; '.
'vertical-align:middle; color:#000; font-family: Verdana, Arial, sans-serif; background-color: #FAA;'.
'text-decoration: none; height: 16px;" value="delete" title="delete" '.
'onclick="return confirm(\'Are you sure you want to do that?\')" />'; // delete + js confirm
echo $this->FormClose();
if($this->HasAccess("write")){
echo"<form action=\"".$this->href()."\" method=\"post\" enctype=\"multipart/form-data\">\n";
if (!$this->config["rewrite_mode"])
echo"<input type=\"hidden\" name=\"wakka\" value=\"".$this->MiniHref()."\">\n";
echo "<input type=\"file\" name=\"blob_upload\"></input>\n";
echo "<input type=\"submit\" value=\"submit\"></input>\n";
##/handlers/page/blob.php##
See /action/blob.php
if($_GET['hash']){ // get file
"FROM ".$this->config["table_prefix"]."blob WHERE `hash` = '".mysql_escape_string($_GET['hash'])."' ");
if($_GET['action'] == 'download' )
}else{ // Bad link
echo "You have not configured the 'blob' handler correctly.";
/actions/base64.php
This allows BASE-64 encoded files to be embedded in Wikka pages.
This moddiffied version uses SHA1-hashes sent back to the script not the data
1.1 Add view button
1.0 Changed to sending SHA to the script rather than the data.
0.9 Orginal version
@example This wikka example containes a random bit of data. {{base64 type="image/png" filename="pix1.png" data="FJSFNSIJFDisjdsjd=2/"}}
if(is_array($vars) && $vars['data']){
$vars['data'] = preg_replace('/\s+/', '', $vars['data']);
$filename = $vars['filename'] ? $vars['filename'] : 'Untitled.txt';
$size = (int)(strlen($vars['data'])*3/4);
$type = $vars['type'] ? $vars['type'] : 'text/plain';
$sha1 = sha1($vars['data']);
if($_POST['base64-sha1'] == $sha1){
$data = base64_decode($vars['data']);
header("Content-Length: ".strlen($data));
header("Content-Type: $type");
header("Content-Disposition: attachment; filename=\"$filename\"");
echo $data;
echo "Filename: ".$filename."<br />\n";
echo "Type: ".$type."<br />\n";
echo "Size: ".$size." Bytes<br />\n";
echo '<input type="hidden" name="base64-sha1" value="'.$sha1."\" />\n";
}else{
echo "You have not configured the 'base64' action correctly.";
- The first, which i call 'blob', allows you to upload files ( up to 1 MiB (MySQL limit of packet )) to the wikka powered site. As well you can embed the file into pages, create a link to the file, or show a description ( incl of view/download link ). It uses two files but the action file is all that is required if you only wish to upload or show the description of the files.
- The second allows small files to be embeded into a page if they are base64 encoded
Enjoy.
Any comments would be appreciated.
Since i do not have access to Internet Exploder YMMV if you are accessing these page with //that// browser.
##/action/blob.php##
1.3 Image + link
1.2 Changed so that it will only allow uploads if the user has R/W to the page.
Image
{{blob hash="SHA1 SUM" type="image"}}
link
{{blob hash="SHA1 SUM" type="link"}}
if(strtolower($vars['type']) == 'link'){
echo "<a href=\"".$this->href('blob',$this->GetPageTag(),'action=view&hash='.$row['hash'])."\">";
echo "{$row['name']}";
echo "</a>";
}elseif(strtolower($vars['type']) == 'image'){
echo "<a href=\"".$this->href('blob',$this->GetPageTag(),'action=view&hash='.$row['hash'])."\">";
echo " <img src=\"".$this->href('blob',$this->GetPageTag(),'action=view&hash='.$row['hash'])."\" />";
echo "</a>";
}else{
echo $this->FormOpen();
echo "<div class=\"code\">\n";
echo "Filename: ".$row['name']."<br />\n";
echo "Type: ".$row['type']."<br />\n";
echo "Size: ".$row['size']." Bytes<br />\n";
echo "</div>\n";
echo '<input type="hidden" name="blob_sha1" value="'.$row['hash']."\" />\n";
echo '<input type="submit" name="download" style="line-height:10px;float:right;'.
'vertical-align:middle;margin-right:20px; margin-top: 0px; font-size: 10px; '.
'color:#000; font-weight: normal; font-family: Verdana, Arial, sans-serif; background-color: #DDD;'.
'text-decoration: none; height: 18px;" value="download" title="Download this item" />'."\n";
echo '<input type="submit" name="view" style="line-height:10px;float:right;'.
'vertical-align:middle;margin-right:20px; margin-top: 0px; font-size: 10px; '.
'color:#000; font-weight: normal; font-family: Verdana, Arial, sans-serif; background-color: #DDD;'.
'text-decoration: none; height: 18px;" value="view" title="View this item" />'."\n";
// FIXME remove unneeded style items
echo $this->FormClose();
if($_POST['blob_delete'] && $this->HasAccess("write") ){
if($_FILES['blob_upload']['name'] && $this->HasAccess("write") && !$_FILES['blob_upload']['error'] ){
if($this->HasAccess("write")){
echo $this->FormOpen();
echo '<input type="hidden" name="blob_sha1" value="'.$row['hash']."\" />\n";
echo '<input type="submit" name="blob_delete" style="font-size: 9px; '.
'vertical-align:middle; color:#000; font-family: Verdana, Arial, sans-serif; background-color: #FAA;'.
'text-decoration: none; height: 16px;" value="delete" title="delete" '.
'onclick="return confirm(\'Are you sure you want to do that?\')" />'; // delete + js confirm
echo $this->FormClose();
if($this->HasAccess("write")){
echo"<form action=\"".$this->href()."\" method=\"post\" enctype=\"multipart/form-data\">\n";
if (!$this->config["rewrite_mode"])
echo"<input type=\"hidden\" name=\"wakka\" value=\"".$this->MiniHref()."\">\n";
echo "<input type=\"file\" name=\"blob_upload\"></input>\n";
echo "<input type=\"submit\" value=\"submit\"></input>\n";
##/handlers/page/blob.php##
See /action/blob.php
if($_GET['hash']){ // get file
"FROM ".$this->config["table_prefix"]."blob WHERE `hash` = '".mysql_escape_string($_GET['hash'])."' ");
if($_GET['action'] == 'download' )
}else{ // Bad link
echo "You have not configured the 'blob' handler correctly.";
/actions/base64.php
This allows BASE-64 encoded files to be embedded in Wikka pages.
This moddiffied version uses SHA1-hashes sent back to the script not the data
1.1 Add view button
1.0 Changed to sending SHA to the script rather than the data.
0.9 Orginal version
@example This wikka example containes a random bit of data. {{base64 type="image/png" filename="pix1.png" data="FJSFNSIJFDisjdsjd=2/"}}
if(is_array($vars) && $vars['data']){
$vars['data'] = preg_replace('/\s+/', '', $vars['data']);
$filename = $vars['filename'] ? $vars['filename'] : 'Untitled.txt';
$size = (int)(strlen($vars['data'])*3/4);
$type = $vars['type'] ? $vars['type'] : 'text/plain';
$sha1 = sha1($vars['data']);
if($_POST['base64-sha1'] == $sha1){
$data = base64_decode($vars['data']);
header("Content-Length: ".strlen($data));
header("Content-Type: $type");
header("Content-Disposition: attachment; filename=\"$filename\"");
echo $data;
echo "Filename: ".$filename."<br />\n";
echo "Type: ".$type."<br />\n";
echo "Size: ".$size." Bytes<br />\n";
echo '<input type="hidden" name="base64-sha1" value="'.$sha1."\" />\n";
}else{
echo "You have not configured the 'base64' action correctly.";
Deletions:
echo "Type: ".$row['type']."<br />\n";
echo "Size: ".$row['size']." Bytes<br />\n";
if($_POST['blob_delete']){
if($_FILES['blob_upload']['name'] && !$_FILES['blob_upload']['error'] ){
echo '<input type="submit" name="blob_delete" style="font-size: 9px; '.
'vertical-align:middle; color:#000; font-family: Verdana, Arial, sans-serif; background-color: #FAA;'.
'text-decoration: none; height: 16px;" value="delete" title="delete" '.
'onclick="return confirm(\'Are you sure you want to do that?\')" />'; // delete + js confirm
echo"<form action=\"".$this->href()."\" method=\"post\" enctype=\"multipart/form-data\">\n";
if (!$this->config["rewrite_mode"])
echo"<input type=\"hidden\" name=\"wakka\" value=\"".$this->MiniHref()."\">\n";
echo "<input type=\"file\" name=\"blob_upload\"></input>\n";
echo "<input type=\"submit\" value=\"submit\"></input>\n";
echo $this->FormClose();
Additions:
) Type=MyISAM;
Deletions:
) ENGINE=MyISAM DEFAULT