0
Tuesday
22
Mar-2005
Use the following code in your target page from the file upload form to handle saving the file on the server:
//set the destination directory$uploaddir = '/var/www/uploads/';//set the destination file name$uploadfile = $uploaddir . $_FILES['userfile']['name'];print('');//move file to designated directory, then test if successfulif (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)){ print('File is valid, and was successfully uploaded. '); print('Here's some more debugging info:n'); print_r($_FILES);}//show if problems occurelse{ print('Possible file upload attack! Debugging info:n'); print_r($_FILES);}print('');
No Response to "PHP - File Uploading How-To"
Be the first to comment! :)