Jump to content

File Uploading Script


Mudsaf
 Share

Recommended Posts

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

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 by Mudsaf
Link to comment
Share on other sites

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...