Link to home
Start Free TrialLog in
Avatar of asi
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
Avatar of ospire
ospire

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
Avatar of periwinkle
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?
Avatar of asi

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/put/the/file";

$filename=~s/^[a-zA-Z]://;
$filename=~m{^.*[/\\](.*?)$};
$filename=$1;

open (OUTFILE,">>$ImageDir/$filename");
while ($bytesread=read($handle,$buffer,1024)) {
   print OUTFILE $buffer;
}
close(OUTFILE);
   
print redirect($ENV{HTTP_REFERER});  
Here is a php example:


print "\n<form ENCTYPE=\"multipart/form-data\"  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>";

If you prefer ASP, try Aspemail at:

  http://www.aspemail.com/

You can upload and download with it.
ASKER CERTIFIED SOLUTION
Avatar of wizzkidd
wizzkidd

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial