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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.