Mudsaf Posted May 28, 2012 Share Posted May 28, 2012 Okay this is part of my file upload script what has been taken from tizag websites. Somehow this is giving me the error and $target_path = ../Materials/ if (isset($_GET['submit'])) {$target_path = $_GET['directory'];$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "File ". basename( $_FILES['uploadedfile']['name']). " has been sussefully added to websites.";} else { echo "There was error during upload, please check that filesize is not higer than 8MB.";echo $target_path;}} Link to comment Share on other sites More sharing options...
Ingolme Posted May 28, 2012 Share Posted May 28, 2012 This isn't the safest script. What does the error say? Link to comment Share on other sites More sharing options...
Mudsaf Posted May 28, 2012 Author Share Posted May 28, 2012 (edited) Notice: Undefined index: tiedosto in E:\xampp\htdocs\admin\lisaa_tiedosto.php on line 422 Here is part of my form that does php_self <label>Tiedosto: <input type='file' name='tiedosto' id='tiedosto' /> </label> And here is PHP if (isset($_GET['submit'])) {$target_path = $_GET['directory'];$target_path = $target_path . basename( $_FILES['tiedostot']['name']); if(move_uploaded_file($_FILES['tiedostot']['tmp_name'], $target_path)) { echo "File ". basename( $_FILES['tiedostot']['name']). " has been sussefully added to websites.";} else { echo "There was error during upload, please check that filesize is not higer than 8MB.";echo $target_path;}} Tried to edit $_FILES['uploadedfile'] to ['tiedostot'] Oh readed it cannot be used with get method have to change to post ^^ Edited May 28, 2012 by Mudsaf Link to comment Share on other sites More sharing options...
TheGallery Posted May 28, 2012 Share Posted May 28, 2012 This isn't the safest script. Why is that? Because he is not checking what kind of file is uploaded? Link to comment Share on other sites More sharing options...
Ingolme Posted May 28, 2012 Share Posted May 28, 2012 Why is that? Because he is not checking what kind of file is uploaded?Not only that, but the user can even choose which directory to upload files to. Link to comment Share on other sites More sharing options...
TheGallery Posted May 28, 2012 Share Posted May 28, 2012 Not only that, but the user can even choose which directory to upload files to. Just realized that. Thanks. Link to comment Share on other sites More sharing options...
justsomeguy Posted May 28, 2012 Share Posted May 28, 2012 Is it supposed to be 'tiedostot' or 'tiedosto'? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now