PDA

Click to See Complete Forum and Search --> : File upload problem using apache


lanza
Mar 4th, 2004, 02:36 PM
Hi!
Im running apache on windows XP proffessional and i wanted to make a simple file upload script to my computer. The problem is that when i upload from my computer to my computer the file gets uploaded but when somebody else tries to upload it remotely, nothing happens - no error messages - it just wont upload. Is there a problem with my apache configuring skills or something else. The file to be uploaded is JPEG so different formats shouldnt be the case. I have added the code below:


<?php
if(($_FILES['file']['type']=='image/jpeg')&&($_FILES['file']['size']<1000000)){
$pic='/web/Pic/Pictures/'.$_POST['name'].'.jpeg';
move_uploaded_file($_FILES['file']['tmp_name'], $pic);
}
?>

<form action='upload.php' method='POST' ENCTYPE='multipart/form-data'>
<input type='file' name='file' size='5'><br />
<input type='text' name='name' />
<input type='submit' name='submit' value='LISA PILT' />
</form>


Thanks in advance.

phpman
Mar 4th, 2004, 04:13 PM
because it is not a POST name

$pic='/web/Pic/Pictures/'.$_POST['name'].'.jpeg';


should be

$pic='/web/Pic/Pictures/'.$_FILES['file']['name'];