Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
I'm tryting to allow free fiile hosting with an upload script and form.
Old 02-23-2009, 03:15 PM I'm tryting to allow free fiile hosting with an upload script and form.
Junior Talker

Posts: 2
Name: Jesse
Trades: 0
With very little limitations. I'm ****ing up the script somehow though


here is the script:

http://jessethegreat.com/cgi-bin/upload.cgi

and here are the two forms that i've tried:

http://jessethegreat.com/file_upload2.html
http://jessethegreat.com/file_upload.html
xzaviergomez is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-24-2009, 09:20 AM Re: I'm tryting to allow free fiile hosting with an upload script and form.
Joak1m's Avatar
Average Talker

Posts: 17
Trades: 0
We cant see the script like that, can we
You have to paste it here.
__________________

Please login or register to view this content. Registration is FREE
Joak1m is offline
Reply With Quote
View Public Profile Visit Joak1m's homepage!
 
Old 02-24-2009, 01:48 PM Re: I'm tryting to allow free fiile hosting with an upload script and form.
Junior Talker

Posts: 2
Name: Jesse
Trades: 0
I'm sorry, I thought you could view the source.


#!/usr/bin/perl -wT

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

$CGI::POST_MAX = 1024 * 2000000;

my $safe_filename_characters = "a-zA-Z0-9_.-";

my $upload_dir = "/jessethegreat.com";

my $query = new CGI;
my $filename = $query->param("file");
my $email_address = $query->param("username");

if ( !$filename )
{
print $query->header ( );
print "File sizes will be temporarily limited to 2GB. ";
exit;
}

my ( $name, $path, $extension ) = fileparse ( $filename, '\..*' );
$filename = $name . $extension;

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

if ( $filename =~ /^([$safe_filename_characters]+)$/ )
{
$filename = $1;
}
else
{
die "Filename contains charcters I am not currently allowing. Just name it with number and letters like a normal person.";

my $upload_filehandle = $query->upload("file");

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

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

close UPLOADFILE;
}

print $query->header ( );
print <<END_HTML;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Thanks!</title>
<style type="text/css">
img {border: none;}
</style>
</head>
<body>
<p>It worked.</p>
<p>Username: $email_address</p>
<p>File:</p>
<p><a href="/upload/$filename"> Click here to view</p>
</body>
</html>
END_HTML
xzaviergomez is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to I'm tryting to allow free fiile hosting with an upload script and form.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.44490 seconds with 12 queries