note 64018 deleted from function.move-uploaded-file by cmb

From: Date: Mon, 08 Apr 2019 06:39:00 +0000
Subject: note 64018 deleted from function.move-uploaded-file by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-210563@lists.php.net to get a copy of this message
Note Submitter: jessy dot diamondman at gmail dot com ---- I am pretty new, and am having upload problems myself, but I think I can help out ffproberen2 at dodgeit dot com with his premission denied errors. I had these two, and I had to change the upload directory, not the tmp_upload_dir or what ever it is called. The move_uploaded_file meathod takes an upload location as the last parameter. I am running a bundled package of Apache, Php, mySQL and so on, and on mine, specifing a directory of '' will upload it into C:\Program Files\xampp\apache (my PC is my experimental server, I will get linux, but got to obtain it and internet cuts off after 196mb so can't download it) even though php file is in C:\Program Files\xampp\htdocs\xampp\jessyexum\upload_client.php. This is a code that I found and then modified, hope it can help. It dosn't always upload every file type giving me an error #2. <?php $uploaddir = ''; $uploadfile = $uploaddir . basename($_FILES['upfile']['name']); echo '<pre>'; if (move_uploaded_file($_FILES['upfile']['tmp_name'], $uploadfile)) { echo "File is valid, and was successfully uploaded.\n"; } else { echo "Possible file upload attack!\n"; } echo 'Here is some more debugging info:'; print_r($_FILES); print "</pre>"; ?>

« previous php.notes (#210563) next »