Welcome, Guest. Please login or register.
Did you miss your activation email?
July 30, 2010, 12:00:29 PM
Home Help Search Login Register
News: This is the supporting forum for http://www.xippy.org , the clan website provider

XippY Clan Website Forum  |  General  |  Website Enquiries  |  Topic: How to upload images straight from your site 0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Print
Author Topic: How to upload images straight from your site  (Read 1074 times)
qpr1991
i
**
Offline Offline

Posts: 54


« on: August 25, 2008, 11:07:59 PM »

This is a simple form i made to upload images from your site straight to image shack.


Demo: http://worldselite.xippy.org/index.php?page=204&PageID=7167

Tutorial:
1.create a custom page.
2. Name it
3.Turn true html to yes.
4.past the code below then click modify.

 
Code:
<form action="http://www.imageshack.us/" method="post" enctype="multipart/form-data" target="_blank">

<input type="hidden" name="MAX_FILE_SIZE" value="1048576">
<input type="hidden" name="aff" value="">
<input type="hidden" name="type" value="blank">
<input type="hidden" name="where" value="iframe">
<input type="file" class="textfield" name="fileupload" size="90%"><br />
<input type="submit" value="Upload Photo">

</form>
Logged
Krippler
P
***
Offline Offline

Posts: 158


Life is a Kitty Cat


WWW
« Reply #1 on: August 26, 2008, 12:56:45 AM »

I have a post somewhere with .cgi scripts and such so you can upload it directly to your FTP (VERY useful for CSS demos) if you have one... but thats a bit more complex... I actually had to code the Perl script language to do that!
Logged

LikWydd
XippY Admin
Y
*****
Offline Offline

Posts: 572



WWW
« Reply #2 on: August 26, 2008, 06:32:12 AM »

very nice, cud i have the code to upload demos krippler?

send to me in PM and let me know if i need to edit anything
Logged

Official Team-XippY Clan -- http://www.team-xippy.com
Krippler
P
***
Offline Offline

Posts: 158


Life is a Kitty Cat


WWW
« Reply #3 on: August 28, 2008, 12:45:47 AM »

Code that works perfectly
(Modify as necesary)

The form:
Code:
<p>Upload CEVO Demos:</p>
</div>
<div>
<ul>
<form action="http://valor.nuclearfallout.net/cgi-bin/cevodemo.cgi" method="post" 
enctype="multipart/form-data">
<li><p>               Half 1: <input type="file" name="half1" /></p></li>
<li><p>Name (ex. kripmalicehalf1.dem): <input type="text" name="name1" /> (.dem MUST BE AT THE END!)</p></li>
<li><p>               Half 2: <input type="file" name="half2" /></p></li>
<li><p>Name (ex. kripmalicehalf2.dem): <input type="text" name="name2" /> (.dem MUST BE AT THE END!)</p></li>
<li><p><input type="submit" name="Submit" value="Upload Demos" /></p></li>
</form>
</ul>
</div>
<p><a href=http://valor.nuclearfallout.net/uploadhelp.html>Need Help?  Click here for instructions.</p>

The .cgi:
Code:
#!/usr/bin/perl -wT

use strict;
use CGI;
use CGI::Carp qw ( fatalsToBrowser );
use File::Basename;


my $safe_filename_characters = "a-zA-Z0-9_.-";
my $upload_dir = "../demos/cevos7";
my $query = new CGI;
my $filename1 = $query->param("name1");
my $filename2 = $query->param("name2");


if ( !$filename1 )
{
 print $query->header ( );
 print "There was a problem uploading your demos.... talk to Krippler.";
 print "Tell me its error code 1.";
}

if ( !$filename2 )
{
 print $query->header ( );
 print "There was a problem uploading your demos.... talk to Krippler.";
 print "Tell me its error code 2.";
}


my ( $name1, $path, $extension ) = fileparse ( $filename1, '\..*' );
$filename1 = $name1 . $extension;
my ( $name2, $path, $extension ) = fileparse ( $filename2, '\..*' );
$filename2 = $name2 . $extension;


$filename1 =~ tr/ /_/;
$filename1 =~ s/[^$safe_filename_characters]//g;
$filename2 =~ tr/ /_/;
$filename2 =~ s/[^$safe_filename_characters]//g;


if ( $filename1 =~ /^([$safe_filename_characters]+)$/ )
{
 $filename1 = $1;
}
else
{
 die "Filename contains invalid characters - Tell krippler error code 3";
}
if ( $filename2 =~ /^([$safe_filename_characters]+)$/ )
{
 $filename2 = $1;
}
else
{
 die "Filename contains invalid characters - Tell krippler error code 4";
}


my $upload_filehandle1 = $query->upload("half1");
my $upload_filehandle2 = $query->upload("half2");


open ( UPLOADFILE, ">$upload_dir/$filename1" ) or die "$!";
binmode UPLOADFILE;

while ( <$upload_filehandle1> )
{
 print UPLOADFILE;
}

close UPLOADFILE;


open ( UPLOADFILE, ">$upload_dir/$filename2" ) or die "$!";
binmode UPLOADFILE;
while ( <$upload_filehandle2> )
{
 print UPLOADFILE;
}
close UPLOADFILE;

{
 print $query->header ( );
 print "Demo Upload sucessful.... tell Krippler.";
 print "       Coding was done by Casey (Krippler) Kurtyka";
}
Logged

Krippler
P
***
Offline Offline

Posts: 158


Life is a Kitty Cat


WWW
« Reply #4 on: August 28, 2008, 02:08:18 AM »

most of the changes need to be in the form, make sure the action points to wherever you have the script.  Besides that pretty much just change the parts where it says my name to yours...
Logged

LikWydd
XippY Admin
Y
*****
Offline Offline

Posts: 572



WWW
« Reply #5 on: August 29, 2008, 10:42:39 AM »

i keep getn a forbidden 403 error..

u see this line: #!/usr/bin/perl -wT

does the .cgi need to be in that directory on my webspace or does it matter as long as i have linked to it on the form..
Logged

Official Team-XippY Clan -- http://www.team-xippy.com
Krippler
P
***
Offline Offline

Posts: 158


Life is a Kitty Cat


WWW
« Reply #6 on: August 29, 2008, 09:33:26 PM »

These files can be placed anywhere as long as the directory they are placed in has 755 permissions and the scripts have 700 permissions.
Logged

Pages: [1] Go Up Print 
XippY Clan Website Forum  |  General  |  Website Enquiries  |  Topic: How to upload images straight from your site « previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!