asi
asked on
Upload file to site
hello,
I need some basic html file , that will help me to upload file to my web site.
Can any one send me such a file ?
thank u
Asi
I need some basic html file , that will help me to upload file to my web site.
Can any one send me such a file ?
thank u
Asi
Please Explain your problem clearly.so that i can try to help you
Please Explain your problem clearly.so that i can try to help you
Asi -
Are you asking how to upload your HTML files to the web site?
Or are you asking how to create a form that will allow you to upload a file?
Are you asking how to upload your HTML files to the web site?
Or are you asking how to create a form that will allow you to upload a file?
ASKER
how to create a form that will allow you to upload a file?
Asi - while HTML can be used to define the form, you will need a CGI, ASP, or PHP script to actually upload the file.
You'll have something like:
<form action="/cgi-bin/upload.pl ">
<INPUT TYPE="file" NAME="File1">
<input type=submit>
Your CGI script (called upload.pl in the above example) will look something like:
#!/usr/bin/perl
use CGI qw(:standard);
my $handle=my $filename=param('File1');
$ImageDir = '/full/path/to/where/to/pu t/the/file ";
$filename=~s/^[a-zA-Z]://;
$filename=~m{^.*[/\\](.*?) $};
$filename=$1;
open (OUTFILE,">>$ImageDir/$fil ename");
while ($bytesread=read($handle,$ buffer,102 4)) {
print OUTFILE $buffer;
}
close(OUTFILE);
print redirect($ENV{HTTP_REFERER });
You'll have something like:
<form action="/cgi-bin/upload.pl
<INPUT TYPE="file" NAME="File1">
<input type=submit>
Your CGI script (called upload.pl in the above example) will look something like:
#!/usr/bin/perl
use CGI qw(:standard);
my $handle=my $filename=param('File1');
$ImageDir = '/full/path/to/where/to/pu
$filename=~s/^[a-zA-Z]://;
$filename=~m{^.*[/\\](.*?)
$filename=$1;
open (OUTFILE,">>$ImageDir/$fil
while ($bytesread=read($handle,$
print OUTFILE $buffer;
}
close(OUTFILE);
print redirect($ENV{HTTP_REFERER
Here is a php example:
print "\n<form ENCTYPE=\"multipart/form-d ata\" action=\"" . $PHP_SELF . "\" method=\"post\">";
print "\n<INPUT TYPE=\"hidden\" name=\"task\" value=\"upload\">";
print "\n<P>Upload a file";
print "\n<br><INPUT NAME=\"the_file\" TYPE=\"file\" SIZE=\"35\"><br>";
print "\n<input type=\"submit\" Value=\"Upload\">";
print "\n</form>";
print "\n<form ENCTYPE=\"multipart/form-d
print "\n<INPUT TYPE=\"hidden\" name=\"task\" value=\"upload\">";
print "\n<P>Upload a file";
print "\n<br><INPUT NAME=\"the_file\" TYPE=\"file\" SIZE=\"35\"><br>";
print "\n<input type=\"submit\" Value=\"Upload\">";
print "\n</form>";
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.