php文件上传文档格式.docx

上传人:b****6 文档编号:20272940 上传时间:2023-01-21 格式:DOCX 页数:16 大小:20.70KB
下载 相关 举报
php文件上传文档格式.docx_第1页
第1页 / 共16页
php文件上传文档格式.docx_第2页
第2页 / 共16页
php文件上传文档格式.docx_第3页
第3页 / 共16页
php文件上传文档格式.docx_第4页
第4页 / 共16页
php文件上传文档格式.docx_第5页
第5页 / 共16页
点击查看更多>>
下载资源
资源描述

php文件上传文档格式.docx

《php文件上传文档格式.docx》由会员分享,可在线阅读,更多相关《php文件上传文档格式.docx(16页珍藏版)》请在冰豆网上搜索。

php文件上传文档格式.docx

ç

Ã

æ

/title>

/head>

body>

table>

tralign="

center"

td>

formenctype="

multipart/form-data"

name="

submitform"

action="

upload.php"

method="

post"

inputtype="

hidden"

max_file_size"

value="

1000000"

uploadaction"

1"

/td>

/tr>

inputname="

uploadfile"

type="

file"

size="

30"

submit"

á

»

"

reset"

Ö

/form>

/table>

/center>

/body>

/html>

else:

ú

Â

ë

$uploadaction=0;

echo"

good!

;

$timelimit=60;

/*É

è

Þ

Æ

ä

È

ª

30Ã

É

²

*/

set_time_limit($timelimit);

if(($uploadfile!

="

none"

))

{

$uploadpath=addslashes(dirname($path_translated))."

\upload\"

//É

¾

$filename=$uploadpath.$uploadfile_name;

û

if($uploadfile_size<

1024)//É

ó

{

$filesize=(string)$uploadfile_size."

×

Ú

}

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"

$uploadfile_name($filesize)É

¹

¦

}

else

$uploadfile_nameÉ

unlink($uploadfile);

$uploadfile_nameÒ

}

else

{echo"

ã

Ó

ñ

È

set_time_limit(30);

//»

¸

br>

ahref="

/a>

endif;

¨

name=myformmethod="

tr>

myfile"

tdcolspan="

2"

php

if(isset($submit)){

if($myfile!

="

){

$upload_dir="

c:

winnttemp"

$up=copy($myfile,$upload_dir);

if($up==1){

print("

!

);

else{

print("

."

unlink($myfile);

 

php¼

Í

à

ö

Ò

gif"

"

.jpg"

.jar"

.jad"

.mid"

.mp3"

.bmp"

.wav"

.rm"

.wmvÎ

Ë

ü

$this->

file_type();

OKÁ

classupload{

var$file_type;

var$file_size;

var$file_name;

var$exname;

var$datetime;

functionup($post_name,$path){

$this->

file_name=$_FILES[$post_name]["

name"

];

exname=strtolower(substr($this->

file_name,strrpos($this->

file_name,"

)));

file_size=$_FILES[$post_name]["

size"

file_type=array("

.gif"

.wmv"

datetime=date("

YmdHis"

in_array($this->

exname,$this->

file_type)){

scriptlanguage='

javascript'

alert('

'

history.back();

/script>

break;

}elseif($this->

file_size>

50000"

){

50KB£

}else{

move_uploaded_file($_FILES[$post_name]["

tmp_name"

],$path.$this->

datetime.$this->

exname);

}

functionfileName(){

$pic=$this->

exname;

return$pic;

phpÊ

//a=$('

spanclass="

MultiFile-title"

title="

+MultiFile.STRING.selected.replace('

$file'

v)+'

+MultiFile.STRING.file.replace('

v.match(/[^/\]+$/gi)[0])+'

/span>

),

//Õ

.

//È

ext=String(v.match(/.w{1,4}$/gi));

//v±

Á

Ë

ù

imgÀ

varimgs=(ext=='

.jpg'

||ext=='

.gif'

.png'

)?

imgonmouseover="

alert(this.src)"

width="

src="

+v+'

/>

:

//´

+imgs+'

¾

a=$('

'

aclass="

a_b"

href="

javascript:

÷

å

rsok="

+slave_count+'

onclick="

returnfalse"

b=$('

MultiFile-remove"

#'

+MultiFile.wrapID+'

+MultiFile.STRING.remove+'

DOCTYPEhtmlPUBLIC"

-//W3C//DTDXHTML1.0Transitional//EN"

"

http:

//www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"

htmlxmlns="

//www.w3.org/1999/xhtml"

metahttp-equiv="

Content-Type"

content="

text/html;

charset=utf-8"

/>

ê

scripttype="

text/javascript"

jquery.js"

jquery.MultiFile.js"

<

--

$(function(){

//²

jqueryÊ

//alert('

jquery'

//Ó

Ý

$('

#T7'

).MultiFile({

list:

#T7-list'

});

})

-->

bodystyle="

font-size:

14px;

margin:

10%;

height:

--½

¢

ID#T7Ï

divÎ

T7-listÀ

-->

inputid="

T7"

upfile"

divid="

T7-list"

/div>

div>

ahref="

alert($('

).html())"

í

//¶

¼

key¾

0¿

×

rsokÖ

//varint_s=$('

.a_b:

last'

).attr('

rsok'

//Bindfunctionalitytothefirstelement

MultiFile.MultiFile)MultiFile.addSlave(MultiFile.e,0);

PHPÀ

HTML±

Û

HTML´

MAX_FILE_SIZE"

Chooseafiletoupload:

uploaded_file"

Upload"

©

HTML±

POST·

ô

ø

MAX_FILE_SIZEÉ

Webä

¯

ì

php.iniÎ

upload_max_filesize£

2MBµ

¤

PHP´

php.iniµ

post_max_sizeµ

10MBµ

POSTÊ

file_uploadsÉ

On¡

Ù

URIµ

URIÊ

URI£

upload.php¡

PHPÎ

$_FILESÊ

é

uploaded_file'

$_FILES[¡

uploaded_file¡

][¡

name¡

type¡

MIMEÀ

size¡

tmp_name¡

error¡

350KbÉ

JPEG

upload.phpPHP´

//§

heckthatwehaveafile

if((!

empty($_FILES["

]))&

&

($_FILES['

]['

error'

]

==0)){

//CheckifthefileisJPEGimageandit'

ssizeislessthan350Kb

$filename=basename($_FILES['

name'

]);

$ext=substr($filename,strrpos($filename,'

.'

)+1);

if(($ext=="

jpg"

)&

($_FILES["

]["

type"

]=="

image/jpeg"

]<

350000)){

//Determinethepathtowhichwewanttosavethisfile

$newname=dirname(__FILE__).'

/upload/'

.$filename;

//Checkifthefilewiththesamenameisalreadyexistsonthe

server

if(!

file_exists($newname)){

//Attempttomovetheuploadedfiletoit'

snewplace

if((move_uploaded_file($_FILES['

['

tmp_name'

],$newname))){

echo"

It'

sdone!

Thefilehasbeensavedas:

.$newname;

}else{

Error:

Aproblemoccurredduringfileupload!

File"

.$_FILES["

]."

already

exists"

Only.jpgimagesunder350Kbareacceptedforupload"

}else{

Nofileuploaded"

®

JPEGÍ

350Kbµ

move_upload_file£

PHPÒ

PHPÉ

GIFº

PNGÍ

PHP²

ð

phpÉ

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 小学教育 > 小升初

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1