This upload script i made is not working. Link: http://59codes.com/uploader/test.php Try upload something to get the error. Source: <? if($_POST['submit']) { $uploadpath = "uploads"; // Upload path $filesizemax = "2097512"; // Max file size $filetypesallowed = array(".gif",".jpg",".png"); // File types allowed ### Set variables $tempfile = $_FILES['file']['tmp_name']; $filename = $_FILES['file']['name']; $filesize = $_FILES['file']['size']; ### Begin upload if($filename == NULL or $filesize = "0") { echo "File invalid"; die; } else { $typenow = strtolower(strstr($filename,".")); // Converters text to lower cases and then serperates the filename from the gif/jpg/png if(!in_array($typenow,$filetypesallowed)) { echo "file type not allowed"; die; } else { if($filesize > $filesizemax) { echo "File is too big"; die; } else { if (move_uploaded_file($tempfile,"$uploadpath")) { echo "file uploaded - <a href='$uploadpath/$filename$typenow'>Click</a>"; } else { echo "error could not move file"; } } } } } ?> <form method="post" enctype="multipart/form-data" name="form1" action="<?php $_SERVER['PHP_SELF']; ?>"> <label> <input type="file" name="file" id="fileField"> </label> <label> <input type="submit" name="submit" id="button" value="Submit"> </label> </form> PHP: Thanks
Well it's one. I didn't try uploading until now. if (move_uploaded_file($tempfile, $uploadpath . $filename)) { PHP: The second argument should be the full path and file name.