Php file upload program (two simple file upload programs ). Php file upload program (two simple file upload programs) * these two file upload programs are very simple and suitable for beginners to learn php file Upload instance tutorials. Php Tutorial php file upload program (two simple file upload programs)/* these two file upload programs are very simple, it is suitable for beginners to learn php file Upload instance tutorials.
Php Tutorial file upload program (two simple file upload programs)
/*
These two file upload programs are very simple and suitable for beginners to learn php file Upload instance tutorials.
*/
If (! $ Uploadaction ):
?>
File upload interface
Else:
?>
File upload code
$ Uploadaction = 0;
Echo "good! ";
$ Timelimit = 60;/* Set the time-out period. The default time is 30 seconds. if the value is 0, the time-out period is not limited */
Set_time_limit ($ timelimit );
If ($ uploadfile! = "None "))
{
$ Uploadpath = addslashes (dirname ($ path_translated). "upload"; // upload file storage path
$ Filename = $ uploadpath. $ uploadfile_name; // upload file name
If ($ uploadfile_size <1024) // upload the file size
{
$ Filesize = (string) $ uploadfile_size. "byte ";
}
Elseif ($ uploadfile_size <(1024*1024 ))
{
$ Filesize = number_format (double) ($ uploadfile_size/1024), 1). "kb ";
}
Else {
$ Filesize = number_format (double) ($ uploadfile_size/(1024*1024), 1). "mb ";
}
If (! File_exists ($ filename ))
{
If (copy ($ uploadfile, $ filename ))
{Echo "file $ uploadfile_name ($ filesize) uploaded successfully! ";}
Else
{Echo "file $ uploadfile_name Upload failed! ";}
Unlink ($ uploadfile );
}
Else
{Echo "file $ uploadfile_name already exists! ";}
}
Else
{Echo "you have not selected any file upload! ";}
Set_time_limit (30); // restores the default timeout value.
?>
Return
Endif;
?>
Method 2
File Upload
If (isset ($ submit )){If ($ myfile! = "None "){$ Upload_dir = "c: winnttemp ";$ Up = copy ($ myfile, $ upload_dir );If ($ up = 1 ){Print ("file uploaded successfully! ");}Else {Print ("file Upload failed .");}Unlink ($ myfile );}Else {Print ("You have not uploaded any files ");}}?>
Http://www.bkjia.com/PHPjc/444862.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/444862.htmlTechArticlephp file upload program (two simple file upload program)/* these two file upload program is very simple, very suitable for beginners to learn php file Upload instance tutorial Oh. Php Tutorial...