Jump to content

php max file upload


conan318

Recommended Posts

hi i have upload script that is working  if i upload small image files however if i try and upload an image over 2m it wont upload. i have changed the php ini file to 8m and still no luck any idea's on what else i can do so i can upload larger image file? and also need a way to check if the image upload is a .gif .jpeg.png. was thinking i should be able to put in

if $ext==('.gif') and $ext==(.jpeg) and $ext ==('.png'){
upload file
}else { echo "that is not a image file";\
would something like that work?

f($_FILES[uploadedfile]!= none){

$ext_a = explode(".", $_FILES['uploadedfile']['name']);
$ext = $ext_a[1];
/* hashes the file name with the date and time to genrate a uniue file name*/
$img=md5($_FILES['uploadedfile']['name'] . date("m.d.y H:m:s")) . "." . $ext;
$target_path = "c://wamp/www/kurri/gallery/";

$target_path = $target_path .basename($img); 



$insert_user=mysql_query("INSERT INTO main.gallery (imgname,date,username) VALUES ('$img','$mk','$username')") ;
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
    echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
    " has been uploaded";
} else{
    echo "There was an error uploading the file, please try again!";
}


if($insert_user)
{ header("location:gal.php");
die();}
else {
echo "error in registration".mysql_error(); 
}
}

Link to comment
https://forums.phpfreaks.com/topic/244892-php-max-file-upload/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.