I am trying to design a custom form script and I've stumbled across a small problem. I want to implement a file upload into the form, but rather than posting to another file I want to refresh the form and then show that there has been a file uploaded.
I know about changing the form action to: <form action="<?php echo$_SERVER['PHP_SELF']; ?>" method="post" name="form" id="form"> But, what do I need to change to update the script? I'm a newbie, but trying hard to learn! Thanks in advance for any help. Tom <form action="upload.php" method="post" ENCTYPE="multipart/form-data"> <input type="file" size="60" name="spec"> <!-- set the max file size --> <input type="hidden" name="MAX_FILE_SIZE" value="500000"> <input type="submit" value="upload"> </form> <?php //FILE UPLOAD SCRIPT $file = $_POST[file]; $path = "/relative/directory/to/file"; //SET THIS TO THE RELATIVE PATH FROM WHERE THE SCRIPT IS TO WHERE THE FILE SHOULD BE UPLOADED TO, if($file){ print("File name: $file_name<P>/n"); print("File size: $file_size bytes<P>/n"); if(copy($file, "$path/$filename")){ print("Your File was uploaded successfully"); }else{ print("ERROR, your file was not successfully uploaded"); } unlink($file); } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php