عند رفع ملف اكبر من 2mb لايتم رفعه الى السيرفر انا جربت الكود على استضافة مجانية لايعمل وكذلك على السيرفر المحلي ممكن المساعدة
<html>
<head>
<title></title>
</head>
<script type="text/javascript">
function getFrameByName(name) {
for (var i = 0; i < frames.length; i++)
if (frames.name == name)
return frames;
return null;
}
function uploadDone(name) {
var frame = getFrameByName(name);
if (frame) {
ret = frame.document.getElementsByTagName("body")[0].innerHTML;
/* If we got JSON, try to inspect it and display the result */
if (ret.length) {
/* Convert from JSON to Javascript object */
var json = eval("("+ret+")");
/* Process data in json ... */
if(json=="ok")
document.getElementById("file").style.display="none"
document.getElementById("aaa").innerHTML=json
}
}
}
</script>
<body bgcolor="#FFFFFF">
<center>
<FORM action='upload.php' method=post enctype='multipart/form-data' target=hidden_upload>
<DIV><input type=file id=file name='upload_scn' class=file_upload></DIV>
<INPUT type=submit name=submit value=Upload />
<input type="hidden" name="MAX_FILE_SIZE" value="10000000" />
<IFRAME id=hidden_upload name=hidden_upload src='' onLoad='uploadDone("hidden_upload")'
style='width:500;height:90;border:0px solid #fff'></IFRAME>
</FORM>
<div id=aaa> </div>
</center>
</body>
</html><?php
$target_filepath = "tmp/" . basename($_FILES['upload_scn']['name']);
if (move_uploaded_file($_FILES['upload_scn']['tmp_name'], $target_filepath))
$result ="ok";
else
$result="error";
echo json_encode($result);
?>