Php video upload code _ PHP Tutorial

Source: Internet
Author: User
Php video upload code. Htmlheadmetahttp-equivContent-Typecontenttexthtml; charsetgb2312title: the instance titleheadbodyformenctypemultipartform-dataaction for uploading files on the Web site (webjx.com)

Example of webjx.com file Upload


Upfile. php.

Function getname ($ exname ){

$ Dir = "./uploadfile /";

$ I = 1;

If (! Is_dir ($ dir )){

Mkdir ($ dir, 0777 );

}


While (true ){

If (! Is_file ($ dir. $ I. ".". $ exname )){

$ Name = $ I. ".". $ exname;

Break;

}

$ I ++;

}


Return $ dir. $ name;

}


$ Exname = strtolower (substr ($ _ FILES ['upfile'] ['name'], (strrpos ($ _ FILES ['upfile'] ['name'], '. ') + 1 )));

$ Uploadfile = getname ($ exname );


If (move_uploaded_file ($ _ FILES ['upfile'] ['tmp _ name'], $ uploadfile )){

Echo "file uploaded successfully!

";

} Else {

Echo "file Upload failed!

";

} Echo "the following information about file upload:

Original file name: ". $ _ FILES ['upfile'] ['name']."

Type: ". $ _ FILES ['upfile'] ['type']."

Temporary File name: ". $ _ FILES ['upfile'] ['tmp _ name']."

File size: ". $ _ FILES ['upfile'] ['size']."

Error code: ". $ _ FILES ['upfile'] ['error'];
?>

Http://www.bkjia.com/PHPjc/477167.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/477167.htmlTechArticlehtml head meta http-equiv = Content-Type content = text/html; charset = gb2312 title web tutorial (webjx.com) file upload instance/title/head body form enctype = multipart/form-data action =...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.