vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Signature images upload (https://vborg.vbsupport.ru/showthread.php?t=39627)

Ice Man_00 06-08-2002 06:32 PM

Signature images upload
 
Hi guys.

I have tried to make a upload script. What i really wanted it to di, was that i implented it to the board and when i fellow upload a file, the nickname will be the file name too.

But i can`t get it to work, so i ask here... please help ?!?! :)

Here`s the code:
PHP Code:

 <?php

 $file_dir
="/home/board/www/forums/images/sigs/";
 
$url_prefix="http://www.your.url/forums/images/sigs/";
 
$max_kilobytes 2048;

 if(
$userfile && $newname)
 {
     
$userfile_name=basename($userfile_name);

     if(
stristr($userfile_name".php"))
     {
         die(
"Sorry you are not allowed to upload php-scripts.");
     }

     if (
$userfile == "none"// image > $max_kilobytes
     
{
         echo 
"Image rejected: exceeds max size ($max_kilobytes k) - please upload a smaller image";
     } else {

         if (
file_exists($file_dir.$newname))
         {
             echo 
"Image rejected: a file called '$newname' already exists - please choose another name.";
         } else {
             if (
copy($userfile$file_dir.$newname))
             {
                 
unlink($userfile);
                 echo 
"File successfully uploaded. Paste this text:<br>";
                 echo 
"<textarea rows=\"2\" cols=\"60\">?$url_prefix$newname</textarea><br />";
                 echo 
"to place this image: <br><img src=\"$url_prefix$newname\">";
             } else {
                 echo 
"Upload failed...";
             }
         }
     }
 }

 
?>
 <hr>

 <form enctype="multipart/form-data" action="sig.php" method=post>

 <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo ($max_kilobytes 1000); ?>">

 <p>
     Select file to send:<br>
     <input name="userfile" type="file"><br>
     (Images should be 300 pixels wide or less and under <?php echo $max_kilobytes?>k)
 </p>

 <p>
     Call this file:<br>
     <input type="text" name="newname" value="PictureName.jpg"> (must end in .jpg or .gif)<br>
     (Please only press once - depending on the size of the graphic it may take a while to upload).
 </p>

 <input type="submit" value="Send file">

 </form>
 </body>
 </html>



All times are GMT. The time now is 09:09 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01002 seconds
  • Memory Usage 1,724KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (1)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete